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

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

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).