Did you know, there can be 61 seconds in a minute? Obviously this is the leap second, which can be introduced at the middle or end of the year. While I was aware of this, it became an important point to consider when I was deciding on a means of validating time data. Restricting the range of seconds to 0-59 is not sufficient, because of potential leap seconds. While most system clocks don’t report leap seconds, and therefore have to rely on a SysAdmin or NTP to adjust the clock, some systems are gaining sufficient accuracy to have leap seconds included.
I wonder what this would do to systems that currently assume data ranges to be 0-59? For example, imagine a display of an analogue clock, where for efficiency the angles (and possible images) of the second hand at 60 positions have been stored in an array. What happens when this program tries to display the 61st second? Buffer overflow? Clock crash? A one-second display of a randomly angled second hand?
I don’t know, but I figure this might have happened last December 31st when we had a leap second. Meanwhile, I’m going to take a “second” look at my validation routines.
Categorised as: Uncategorized