#294 Bug in TCTimes.py

open
nobody
zsi (169)
5
2010-12-01
2010-12-01
Neeraj Koul
No

File -> TCTimes.py

In _dict_to_tuple function ( which converts dictionary to a time tuple ), there is a bug in calculating the minutes' offset

The line is
local_offset_min = (offset.seconds%3600)%60

This doesn't give the minutes' offset.. Suppose offset.seconds = 60, then the above calculation yields (60%3600)%60 -> (0)%60 -> 0.. Rather the minutes' offset is 60 secs = 1 min, which we get by (60%3600)/60

So we should have this line instead,

local_offset_min = (offset.seconds%3600)/60

Discussion