forked from hummypkg/webif
Revert to using clock scan to determine midnight
This commit is contained in:
parent
9c80bb0601
commit
69d0e6597d
@ -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 "<pre>"
|
||||
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 "</pre>"
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# 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 "
|
||||
<fieldset id=sched_timeline class=visual>
|
||||
|
@ -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"]
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user