aboutsummaryrefslogtreecommitdiff
path: root/static/time.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/time.js')
-rw-r--r--static/time.js29
1 files changed, 15 insertions, 14 deletions
diff --git a/static/time.js b/static/time.js
index 3e5650d..ac093b1 100644
--- a/static/time.js
+++ b/static/time.js
@@ -1,27 +1,28 @@
+var colon = ":";
function updateTime(){
var date = new Date()
var hours = date.getHours()
var minutes = date.getMinutes()
- var seconds = date.getSeconds()
- var old_hours = hours;
- if (hours > 12) {
+ if (hours > 11)
+ var tod = " pm";
+ else
+ var tod = " am";
+
+ if (hours > 12)
hours = hours - 12
- } else if (hours == 0) {
+ else if (hours == 0)
hours = 12
- }
- if (minutes < 10) {
+ if (minutes < 10)
minutes = "0" + minutes
- }
- var t_str = hours + ":" + minutes;
- if (old_hours > 11) {
- t_str += " pm";
- } else {
- t_str += " am";
- }
+ if (colon === ":")
+ colon = " ";
+ else if (colon === " ")
+ colon = ":";
+ var t_str = hours + colon + minutes + tod;
document.getElementById('time').innerHTML = t_str;
}
-setInterval(updateTime, 1);
+setInterval(updateTime, 500);