diff --git a/webif/html/sched/visual/index.jim b/webif/html/sched/visual/index.jim index 84e1902..29cca20 100755 --- a/webif/html/sched/visual/index.jim +++ b/webif/html/sched/visual/index.jim @@ -26,12 +26,12 @@ proc lsum {l} { expr [join $l +] + 0 } -proc pop_event {{debug 0}} { +proc pop_event {} { uplevel { lassign [lindex $events $eindex] \ start end hsvc eid slotid kind sclass incr eindex - if {$debug > 1} { + if {$debug > 2} { puts " -------------------------------------------------- EVENT$eindex @@ -72,7 +72,7 @@ foreach p $pending { set elen [llength $events] set eindex 0 while {$eindex < $elen} { - pop_event 1 + pop_event if {$slotid ne [$s get ulslot]} continue @@ -81,10 +81,6 @@ foreach p $pending { } } -#foreach ev $events { -# puts $ev -#} - # Event array keys: # 0: start # 1: end @@ -107,6 +103,23 @@ if {[llength $skip]} { # Sort final events array set events [lsort -index 0 -integer [lsort -index 2 -integer $events]] +if {$debug} { + puts "
"
+	foreach ev $events {
+		puts -nonewline $ev
+		lassign $ev start end hsvc eid slotid kind sclass
+		catch {
+			set s [rsv slot $sclass $slotid]
+			set shour [clock format $start -format "%H"]
+			set ehour [clock format $end -format "%H"]
+			set elapsed $($end - $start)
+			puts -nonewline "  = $shour,$ehour ($elapsed) - [$s name]"
+		}
+		puts ""
+	}
+	puts "
" +} + ###################################################################### # Visualisation functions @@ -409,7 +422,7 @@ proc render_timeline {usedhours} { set usedhours [lrepeat 24 0] -# Determine which hours are usde. +# Determine which hours are used. foreach e $events { lassign $e start end set shour [clock format $start -format "%H"] @@ -425,7 +438,7 @@ foreach e $events { } # To show 24 hours -# set usedhours [lrepeat 24 1] +#set usedhours [lrepeat 24 1] puts "
diff --git a/webif/lib/utils b/webif/lib/utils index 623fccd..bab547c 100644 --- a/webif/lib/utils +++ b/webif/lib/utils @@ -12,8 +12,9 @@ proc lremove {var val} { set v [lsearch -all -inline -not -exact $v $val] } -# Returns the epoch time for midnight today +# Returns the epoch time for midnight today, accounting for local timezone proc midnight {} { - return $([clock seconds] / 86400 * 86400) + #return $([clock seconds] / 86400 * 86400) + set day [clock scan "00:00:00" -format "%T"] }