Posted to tcl by kyak at Thu Jan 10 05:11:45 GMT 2019view pretty

set interval [expr [clock scan "10 Jan 2019 11:00:00"] - [clock scan "1 Oct 2018 00:00:00"]]
8766000
set days [expr {round($interval / double(60*60*24))}]
101
# ok, assume that 101 days is the correct number. Let's add one hour
set interval [expr [clock scan "10 Jan 2019 12:00:00"] - [clock scan "1 Oct 2018 00:00:00"]]
8769600
set days [expr {round($interval / double(60*60*24))}]
102
# now we get 102 days, this can't be correct

Comments

Posted by avl at Fri Jan 11 11:47:34 GMT 2019 [text] [code]

you might want to see the interval more fine grained by leaving out the rounding. That will show, that first figure is 101.45833333..., whereas the second figure without rounding is 101.5 and is thus rounded up. By the way, some people (at least in europe, but maybe more or not all europeans) will have a DST-switch near end of october, which means that the first interval is already 8769600 (as large as your second).