From 59bbcc09fb11921a881d5c90daf794d018a18451 Mon Sep 17 00:00:00 2001 From: HummyPkg Date: Wed, 8 May 2019 14:20:07 +0100 Subject: [PATCH] Better way of determining midnight (does not require jim patch) --- webif/lib/utils | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/webif/lib/utils b/webif/lib/utils index bab547cf..53eaf041 100644 --- a/webif/lib/utils +++ b/webif/lib/utils @@ -13,8 +13,10 @@ proc lremove {var val} { } # Returns the epoch time for midnight today, accounting for local timezone -proc midnight {} { - #return $([clock seconds] / 86400 * 86400) - set day [clock scan "00:00:00" -format "%T"] +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"] }