[racket] find-seconds, second : (integer-in 0 61)

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Jun 5 09:44:49 EDT 2011

At Fri, 3 Jun 2011 21:47:04 -0400, "Geoffrey S. Knauth" wrote:
> Does any PLT Scheme or Racket code actually track or use 
> those leap seconds?

For some functions, it depends on the library and configuration
provided by the OS. My impression is that leap seconds are typically
not tracked.

Specifically, the `find-seconds' function is implemented using
`seconds->date', which is in turn implemented with localtime() and
gmtime(). Whether leap seconds are taken into account by localtime()
and gmtime() depends on whether the relevant timezone is configured to
include leap-second corrections, and I think timezones are usually
configured to omit the correction. Instead, most system rely on NTP to
fix up a system's clock, so that the result of `current-seconds'
becomes one less than the actual number of seconds that have elapsed
since 1970.

At least, that's how I think it works. I'm not completely certain
beyond the fact that `seconds->date' uses localtime()/gmtime().

Posted on the users mailing list.