Also to be found out there, and which would need attention, is use of 0 as a sentinel
if time = 0
// handle missing data case
else
...
The kind of thing that makes you wonder "what sort of a day was 1 Jan 1970, actually?"