summaryrefslogtreecommitdiff
path: root/tempo.js
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-02-26 13:11:45 -0800
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-02-26 13:11:45 -0800
commiteabbe53c13e5fcf45a50b2163c871e6f9d55f991 (patch)
treea24f23561feca6e50084a1ca083911293114e17f /tempo.js
parent89ca2bfe654ee86b1190ebe28fd0038cb6fddc42 (diff)
downloadtempo-eabbe53c13e5fcf45a50b2163c871e6f9d55f991.tar.gz
tempo-eabbe53c13e5fcf45a50b2163c871e6f9d55f991.tar.xz
Add option for 12-hour time.
Diffstat (limited to 'tempo.js')
-rw-r--r--tempo.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/tempo.js b/tempo.js
index 6fed6ad..0d90f5f 100644
--- a/tempo.js
+++ b/tempo.js
@@ -13,6 +13,8 @@ function padTime(x) {
}
function updateTime() {
+ var timeformat = localStorage['timeformat'];
+
var date = new Date();
var h = date.getHours();
@@ -25,6 +27,10 @@ function updateTime() {
var str_d = dd + " " + months[dm] + " " + dy;
+ if(timeformat == '12') {
+ h = (h + 11) % 12 + 1;
+ }
+
document.getElementById("h").innerHTML = padTime(h);
document.getElementById("m").innerHTML = padTime(m);
document.getElementById("s").innerHTML = padTime(s);