[projects/pld-builder.new] queue.html: the time now beside the title

arekm arekm at pld-linux.org
Sat Nov 14 22:14:13 CET 2026


commit 31a514382718077738a10bd770ecb3064e388f80
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat Nov 14 21:27:55 2026 +0100

    queue.html: the time now beside the title
    
    A reference for the times on the page, in their zone and kept going by
    the script.

 PLD_Builder/queue_html.py |  2 ++
 PLD_Builder/script.js     | 11 +++++++++++
 PLD_Builder/style.css     |  5 +++++
 3 files changed, 18 insertions(+)
---
diff --git a/PLD_Builder/queue_html.py b/PLD_Builder/queue_html.py
index fdc2da4..cd9c6d1 100644
--- a/PLD_Builder/queue_html.py
+++ b/PLD_Builder/queue_html.py
@@ -57,6 +57,8 @@ def page(requests):
         '<span id="shown"></span>\n'
         '<label>Requester <select id="requester"><option value="">everyone</option></select></label>\n'
         '<label><input type="checkbox" id="unfinished"> only failed or unfinished</label>\n'
+        # the time now, on the clock of the times below: the script keeps it going
+        f'<time id="clock" data-offset="{time.localtime().tm_gmtoff}" data-zone="{time.strftime("%Z")}"></time>\n'
         '</header>\n'
         + builders_line(requests)
         + f'<main style="--builders: {len(config.binary_builders)}">\n'
diff --git a/PLD_Builder/script.js b/PLD_Builder/script.js
index 0e6f93d..0a94fbb 100644
--- a/PLD_Builder/script.js
+++ b/PLD_Builder/script.js
@@ -16,6 +16,17 @@ function elapsed(el) {
 	return span((Date.now() - new Date(el.getAttribute('datetime'))) / 1000);
 }
 
+// the time now, in the zone of the page's times: the builder's offset, not the reader's
+var clock = document.getElementById('clock');
+function tick() {
+	var d = new Date(Date.now() + clock.dataset.offset * 1000);
+	var two = function(n) { return String(n).padStart(2, '0'); };
+	clock.textContent = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ')[d.getUTCMonth()] + ' ' + d.getUTCDate() + ' '
+		+ two(d.getUTCHours()) + ':' + two(d.getUTCMinutes()) + ':' + two(d.getUTCSeconds()) + ' ' + clock.dataset.zone;
+}
+tick();
+setInterval(tick, 1000);
+
 // counted here and not by the builder: the page is written only when the queue changes
 document.querySelectorAll('time.ago').forEach(function(el) {
 	el.textContent = elapsed(el) + ' ago';
diff --git a/PLD_Builder/style.css b/PLD_Builder/style.css
index 14df3c7..6fb1dae 100644
--- a/PLD_Builder/style.css
+++ b/PLD_Builder/style.css
@@ -37,6 +37,11 @@ select, input {
 	margin-left: -18px;
 }
 
+#clock {
+	margin-left: auto;
+	white-space: nowrap;
+}
+
 /* the line of builders: what each does right now */
 #now {
 	background: #fbf8ef;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/57bea5b9d8439f88b626107bd7ab5c9e600eec83



More information about the pld-cvs-commit mailing list