aboutsummaryrefslogtreecommitdiffstats
path: root/cgit.h
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2018-06-24 15:05:20 +0800
committerChristian Hesse <mail@eworm.de>2019-06-04 13:35:43 +0200
commit0e5cbe120cd76aa8d91d27918c395e2b9ea4deb3 (patch)
treea5b777c0fefc0c60aeaca5fa5ba6324e07a01e17 /cgit.h
parentconfig: add js (diff)
downloadcgit-0e5cbe120cd76aa8d91d27918c395e2b9ea4deb3.tar.xz
cgit-0e5cbe120cd76aa8d91d27918c395e2b9ea4deb3.zip
cgit.css: add dynamic age update
This patch updates the emitted "ages" dynamically on the client side. After updating on completion of the document load, it sets a timer to update according to the smallest age it found. If there are any ages listed in minutes, then it will update again in 10s. When the most recent age is in hours, it updates every 5m. If days, then every 30m and so on. This keeps the cost of the dynamic updates at worst once per 10s. The updates are done entirely on the client side without contact with the server. To make this work reliably, since parsing datetimes is unreliable in browser js, the unix time is added as an attribute to all age spans. To make that reliable cross-platform, the unix time is treated as a uint64_t when it is formatted for printing. The rules for display conversion of the age is aligned with the existing server-side rules in ui-shared.h. If the client or server-side time are not synchronized by ntpd etc, ages shown on the client will not relate to the original ages computed at the server. The client updates the ages immediately when the DOM has finished loading, so in the case the times at the server and client are not aligned, this patch changes what the user sees on the page to reflect patch age compared to client time. If the server and client clocks are aligned, this patch makes no difference to what is seen on the page. Signed-off-by: Andy Green <andy@warmcat.com> Signed-off-by: Christian Hesse <mail@eworm.de>
Diffstat (limited to 'cgit.h')
-rw-r--r--cgit.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/cgit.h b/cgit.h
index bb5e1f5..e2c2604 100644
--- a/cgit.h
+++ b/cgit.h
@@ -25,6 +25,7 @@
#include <utf8.h>
#include <notes.h>
#include <graph.h>
+#include <inttypes.h>
/* Add isgraph(x) to Git's sane ctype support (see git-compat-util.h) */
#undef isgraph