aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-12-22 20:54:18 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-01-08 18:26:00 +0200
commit0882ffc1e3480feb3c067c1f8c961fc384de17e9 (patch)
tree02578ec7d92656e4a6c7be0e7f5b21e190b7dd51
parente24a4bd8dbe885df63f0c5479edd058a262a9960 (diff)
Print repository timestamps on the About page
-rw-r--r--brep/mod-repository-details.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/brep/mod-repository-details.cxx b/brep/mod-repository-details.cxx
index a1a0fa5..18da188 100644
--- a/brep/mod-repository-details.cxx
+++ b/brep/mod-repository-details.cxx
@@ -4,11 +4,18 @@
#include <brep/mod-repository-details>
+#include <time.h> // tzset()
+
+#include <sstream>
+#include <algorithm> // max()
+
#include <xml/serializer>
#include <odb/database.hxx>
#include <odb/transaction.hxx>
+#include <butl/timestamp>
+
#include <web/xhtml>
#include <web/module>
#include <web/mime-url-encoding>
@@ -22,6 +29,7 @@
#include <brep/database>
#include <brep/package-odb>
+using namespace std;
using namespace odb::core;
using namespace brep::cli;
@@ -37,6 +45,8 @@ init (scanner& s)
options_->root (dir_path ("/"));
db_ = shared_database (*options_);
+
+ tzset(); // To use butl::to_stream() later on.
}
bool brep::repository_details::
@@ -100,6 +110,15 @@ handle (request& rq, response& rs)
if (r.email)
s << P << A(HREF="mailto:" + *r.email) << *r.email << ~A << ~P;
+
+ ostringstream o;
+ butl::to_stream (o,
+ max (r.packages_timestamp, r.repositories_timestamp),
+ "%Y-%m-%d %H:%M:%S%[.N] %Z",
+ true,
+ true);
+
+ s << P << o.str () << ~P;
}
t.commit ();