[R] Leap hours?

Berry Boessenkool berryboessenkool at hotmail.com
Wed Dec 11 19:03:49 CET 2013


Hi there,

If you want to show off just how good R handles dates+times, forward this.

I showed some colleagues difftime today, and encountered something interesting:
difftime(ISOdatetime(1936:1947+1,1,1, 0,0,0), ISOdatetime(1936:1947,1,1, 0,0,0))
which returns the values
366, 365, 365, 365, 365.958333, 365, 365.041667, 365, 366, 365, 365, 365

1940 is missing one hour! (1/24 = 0.041667)
1942 has one hour too much.

I first thought of leap hours, and after reading about leap seconds, clock drift, timing attacks, GPS, random number generators and Turing machines, I thought of dailight saving time, and indeed, there were some issues in Germany back then.
http://de.wikipedia.org/wiki/Sommerzeit#Deutschland
http://www.horlogeparlante.com/history.html?city=2950159

R even covers all that - I'm once again amazed!

Sys.getlocale() gives me German_Germany.1252, by the way.

regards,
Berry 		 	   		  


More information about the R-help mailing list