diff --git a/html/index.html b/html/index.html
index 08e799a..7209e61 100644
--- a/html/index.html
+++ b/html/index.html
@@ -92,7 +92,9 @@
- Time (UTC) |
+ Time () |
Mode |
Callsign |
Target |
@@ -129,7 +131,10 @@
- Time (UTC) |
+
+ Time () |
Mode |
Callsign |
Target |
@@ -155,8 +160,12 @@
Callsign |
- Added at |
- Last TX at |
+ Added at () |
+ Last TX at () |
@@ -175,7 +184,10 @@
- Time (UTC) |
+
+ Time () |
Slot |
RIC |
Message |
diff --git a/html/js/config.js b/html/js/config.js
index aaf2bfe..2afe542 100644
--- a/html/js/config.js
+++ b/html/js/config.js
@@ -20,4 +20,7 @@ var showAboutTab = 1;
// default-tab to show
// chose from following list: CurrTXTab, LastHeardTab, LocalHeadTab, InQSOTab, DAPNETMessagesTab, SysInfoTab, AboutTab
-var defaultTab = "LastHeardTab";
\ No newline at end of file
+var defaultTab = "LastHeardTab";
+
+// Set displayed timezone and timestamp to timezone of browser if 1, else use UTC for displaying
+var useClientTimezone = 1;
\ No newline at end of file
diff --git a/html/js/functions.js b/html/js/functions.js
index a18e27e..817bac7 100644
--- a/html/js/functions.js
+++ b/html/js/functions.js
@@ -17,10 +17,52 @@ function logIt(message) {
}
}
-function getTimestamp(logline) {
+function getTimezone() {
+ if (useClientTimezone) {
+ var d = new Date();
+ var usertime = d.toLocaleString();
+
+ // Some browsers / OSs provide the timezone name in their local string:
+ var tzsregex = /\b(ACDT|ACST|ACT|ADT|AEDT|AEST|AFT|AKDT|AKST|AMST|AMT|ART|AST|AWDT|AWST|AZOST|AZT|BDT|BIOT|BIT|BOT|BRT|BST|BTT|CAT|CCT|CDT|CEDT|CEST|CET|CHADT|CHAST|CIST|CKT|CLST|CLT|COST|COT|CST|CT|CVT|CXT|CHST|DFT|EAST|EAT|ECT|EDT|EEDT|EEST|EET|EST|FJT|FKST|FKT|GALT|GET|GFT|GILT|GIT|GMT|GST|GYT|HADT|HAEC|HAST|HKT|HMT|HST|ICT|IDT|IRKT|IRST|IST|JST|KRAT|KST|LHST|LINT|MART|MAGT|MDT|MET|MEST|MIT|MSD|MSK|MST|MUT|MYT|NDT|NFT|NPT|NST|NT|NZDT|NZST|OMST|PDT|PETT|PHOT|PKT|PST|RET|SAMT|SAST|SBT|SCT|SGT|SLT|SST|TAHT|THA|UYST|UYT|VET|VLAT|WAT|WEDT|WEST|WET|WST|YAKT|YEKT)\b/gi;
+
+ // In other browsers the timezone needs to be estimated based on the offset:
+ var timezonenames = {"UTC+0":"GMT","UTC+1":"CET","UTC+2":"EET","UTC+3":"EEDT","UTC+3.5":"IRST","UTC+4":"MSD","UTC+4.5":"AFT","UTC+5":"PKT","UTC+5.5":"IST","UTC+6":"BST","UTC+6.5":"MST","UTC+7":"THA","UTC+8":"AWST","UTC+9":"AWDT","UTC+9.5":"ACST","UTC+10":"AEST","UTC+10.5":"ACDT","UTC+11":"AEDT","UTC+11.5":"NFT","UTC+12":"NZST","UTC-1":"AZOST","UTC-2":"GST","UTC-3":"BRT","UTC-3.5":"NST","UTC-4":"CLT","UTC-4.5":"VET","UTC-5":"EST","UTC-6":"CST","UTC-7":"MST","UTC-8":"PST","UTC-9":"AKST","UTC-9.5":"MIT","UTC-10":"HST","UTC-11":"SST","UTC-12":"BIT"};
+
+ var timezone = usertime.match(tzsregex);
+ if (timezone) {
+ timezone = timezone[timezone.length-1];
+ } else {
+ var offset = -1*d.getTimezoneOffset()/60;
+ offset = "UTC" + (offset >= 0 ? "+" + offset : offset);
+ timezone = timezonenames[offset];
+ }
+
+ return timezone;
+ } else {
+ return "UTC";
+ }
+}
+function getLocaltimeFromTimestamp(timestamp) {
+ logIt(timestamp);
+ if (useClientTimezone) {
+ var localtime = new Date(timestamp + "Z");
+ return localtime.toLocaleString();
+ } else {
+ return timestamp;
+ }
+}
+
+
+function getRawTimestamp(logline) {
return logline.substring(3,22);
}
+
+
+function getTimestamp(logline) {
+ return getLocaltimeFromTimestamp(getRawTimestamp(logline));
+}
+
function getMode(logline) {
return logline.substring(27, logline.indexOf(","));
}
@@ -183,9 +225,10 @@ function leadingZero(zahl) {
function copyToQSO(callsign) {
$(document).ready(function() {
+ var date = new Date().toISOString().split('T')
t_qso.row.add( [
callsign,
- new Date().toUTCString(),
+ getLocaltimeFromTimestamp(date[0] + " " + date[1].substring(0, date[1].indexOf("."))),
""
] ).draw();
});
@@ -302,10 +345,10 @@ function getLastHeard(document, event) {
txing = true;
if (getMode(line) == "DMR Slot 1" ) {
ts1TXing = getMode(line) + ";" + line.substring(line.indexOf("from") + 5, line.indexOf("to")).trim() + ";" + getTarget(line) + ";" + getSource(line);
- ts1timestamp = getTimestamp(line);
+ ts1timestamp = getRawTimestamp(line);
} else {
ts2TXing = getMode(line) + ";" + line.substring(line.indexOf("from") + 5, line.indexOf("to")).trim() + ";" + getTarget(line) + ";" + getSource(line);
- ts2timestamp = getTimestamp(line);
+ ts2timestamp = getRawTimestamp(line);
}
}
if (line.indexOf("network watchdog") > 0 || line.indexOf("end of voice transmission") > 0 || line.indexOf("end of transmission") > 0) {