Sanity check Recording start/end fields

This commit is contained in:
prpr 2023-07-01 12:36:52 +01:00
parent 90b69d0d21
commit 9c5b1a5641
2 changed files with 5 additions and 1 deletions

View File

@ -61,6 +61,10 @@ proc ::expire::directory {dir} {
} }
if {$ax(days) > 0} { if {$ax(days) > 0} {
# Calculate age in days # Calculate age in days
if {[$getter $ts] < [$ts get start]} {
log " End before start, skipping."
continue
}
set age $(($now - [$getter $ts]) / 86400.0) set age $(($now - [$getter $ts]) / 86400.0)
log " $age days (cf. $ax(days))" log " $age days (cf. $ax(days))"
if {$age < $ax(days)} { if {$age < $ax(days)} {

View File

@ -49,7 +49,7 @@ ts method dir {} {
} }
ts method duration {{raw 0}} { ts method duration {{raw 0}} {
set d [expr {$end - $start}] set d $(($end && $start && $end > $start) ? $end - $start : 0)
if {!$raw} { set d $($d / 60) } if {!$raw} { set d $($d / 60) }
return $d return $d
} }