diff --git a/webif/html/sched/visual/index.jim b/webif/html/sched/visual/index.jim
index 354adc4..84e1902 100755
--- a/webif/html/sched/visual/index.jim
+++ b/webif/html/sched/visual/index.jim
@@ -306,7 +306,7 @@ proc render_timeline {usedhours} {
set tomorrow {}
# Midnight today.
- set day [clock scan "00:00:00" -format "%T"]
+ set day [midnight]
set elength [llength $events]
set eindex 0
diff --git a/webif/lib/rsv.class b/webif/lib/rsv.class
index 1605dcd..e1084d7 100755
--- a/webif/lib/rsv.class
+++ b/webif/lib/rsv.class
@@ -1291,7 +1291,7 @@ proc {rsv allevents} {{xota 0}} {
lappend events {*}$pending
}
- set today [clock scan 00:00:00 -format "%T"]
+ set today [midnight]
set xevents {}
diff --git a/webif/lib/utils b/webif/lib/utils
index d9b7726..623fccd 100644
--- a/webif/lib/utils
+++ b/webif/lib/utils
@@ -12,3 +12,8 @@ proc lremove {var val} {
set v [lsearch -all -inline -not -exact $v $val]
}
+# Returns the epoch time for midnight today
+proc midnight {} {
+ return $([clock seconds] / 86400 * 86400)
+}
+