diff --git a/webif/html/epg/service.jim b/webif/html/epg/service.jim
index ce6f77e..764192c 100755
--- a/webif/html/epg/service.jim
+++ b/webif/html/epg/service.jim
@@ -78,7 +78,7 @@ puts "
|
"
-set t [clock seconds]
+set t [midnight]
set firstday [clock format $t -format {%Y%m%d}]
set daymap {}
loop i 0 8 {
@@ -87,7 +87,7 @@ loop i 0 8 {
set day [clock format $t -format {%Y%m%d}]
set daymap($day) $i
set dayrmap($i) $day
- incr t 86400
+ set t [midnight_local $($t+93600)]
}
puts "
diff --git a/webif/html/sched/visual/index.jim b/webif/html/sched/visual/index.jim
index c209931..94e7170 100755
--- a/webif/html/sched/visual/index.jim
+++ b/webif/html/sched/visual/index.jim
@@ -320,8 +320,7 @@ proc render_timeline {usedhours} {
# Midnight today.
set day [midnight]
- set gday [clock scan "[clock format [clock seconds] -format {%Y %m %d}] 00:00:00" \
- -format {%Y %m %d %T} -gmt 1]
+ set gday [midnight_gmt $day]
set elength [llength $events]
set eindex 0
diff --git a/webif/lib/utils b/webif/lib/utils
index 043fe72..ff1b557 100644
--- a/webif/lib/utils
+++ b/webif/lib/utils
@@ -12,12 +12,21 @@ proc lremove {var val} {
set v [lsearch -all -inline -not -exact $v $val]
}
+# Returns the epoch time for midnight on the specified epoch date
+proc midnight_gmt {t} {
+ set dt [clock format $t -format {%F}]
+ return [clock scan "$dt 00:00:00" -format {%F %T} -gmt 1]
+}
+
+# Returns the epoch time for midnight on the specified epoch date, accounting for local timezone
+proc midnight_local {t} {
+ set dt [clock format $t -format {%F}]
+ return [clock scan "$dt 00:00:00" -format {%F %T}]
+}
+
# Returns the epoch time for midnight today, accounting for local timezone
-proc midnight {} {{today ""}} {
- if {$today eq ""} {
- set today [clock format [clock seconds] -format "%Y %m %d"]
- }
- return [clock scan "$today 00:00:00" -format "%Y %m %d %T"]
+proc midnight {} {
+ return [midnight_local [clock seconds]]
}
# Base-64 according to RFC 4648