From e0c35aa0cfaf2569c1e9254d287a98251a771593 Mon Sep 17 00:00:00 2001 From: phl0 Date: Fri, 27 Oct 2023 10:13:11 +0200 Subject: [PATCH] Adapt contest logging --- assets/js/sections/contesting.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/assets/js/sections/contesting.js b/assets/js/sections/contesting.js index 248d85e8..2356d2f7 100644 --- a/assets/js/sections/contesting.js +++ b/assets/js/sections/contesting.js @@ -68,19 +68,11 @@ function setSession(formdata) { // realtime clock if ( ! manual ) { $(function ($) { - var options = { - utc: true, - format: '%H:%M:%S' - } - $('.input_time').jclock(options); + handleStart = setInterval(function() { getUTCTimeStamp($('.input_time')); }, 500); }); $(function ($) { - var options = { - utc: true, - format: '%d-%m-%Y' - } - $('.input_date').jclock(options); + handleDate = setInterval(function() { getUTCDateStamp($('.input_date')); }, 1000); }); } @@ -572,3 +564,17 @@ function pad (str, max) { str = str.toString(); return str.length < max ? pad("0" + str, max) : str; } + +function getUTCTimeStamp(el) { + var now = new Date(); + var localTime = now.getTime(); + var utc = localTime + (now.getTimezoneOffset() * 60000); + $(el).attr('value', ("0" + now.getUTCHours()).slice(-2)+':'+("0" + now.getUTCMinutes()).slice(-2)+':'+("0" + now.getUTCSeconds()).slice(-2)); +} + +function getUTCDateStamp(el) { + var now = new Date(); + var localTime = now.getTime(); + var utc = localTime + (now.getTimezoneOffset() * 60000); + $(el).attr('value', ("0" + now.getUTCDate()).slice(-2)+'-'+("0" + (now.getUTCMonth()+1)).slice(-2)+'-'+now.getUTCFullYear()); +}