7.8. Working with Leap Seconds: Don't!
You want to work with leap seconds? Our advice is: Don't. Leap seconds are very real. One was added to the year 2005its final minute had 61 seconds rather than the usual 60. Although the library routines have for years allowed for the possibility of a 61-second minute, our experience has been that most systems do not keep track of leap seconds. When we say "most," we mean all the ones we've ever checked. For example, a leap second is known to have been inserted at the end of the last day of 1998. Immediately following 23:59:59 came that rare event 23:59:60. But the underlying C libraries on which Ruby is built are ignorant of this. t0 = Time.gm(1998, 12, 31, 23, 59, 59) t1 = t0 + 1 puts t1 # Fri Jan 01 00:00:00 GMT 1999 It is (barely) conceivable that Ruby could add a layer of intelligence to correct for this. At the time of this writing, however, there are no plans to add such functionality. |