Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are leapseconds taken in account in dotNet (or C#)?

Tags:

Does the DateTime struct takes care of this? Does any other class/struct?

UPDATE :

I now have read that leapseconds are only announced 6 months in advance, since the rotation of the earth is not that predictable...

Since there's no possibility to implement that in future dates, I can imagine they just omitted them?

like image 863
Peter Avatar asked Apr 23 '09 11:04

Peter


1 Answers

As far as I know, .NET's DateTime struct does NOT automatically handle leap seconds. I don't think you can even set seconds higher than 59 in .NET's DateTime. However, in Java, you are allowed to set seconds to be 0 - 61, because the ISO standard for it allows for 2 leap seconds per year.

EDIT: I Tried it for kicks:

Trying Dim dt As New DateTime(2008, 12, 2, 12, 34, 61) in .NET throws this message (61 being the number of seconds):

"Hour, Minute, and Second parameters describe an un-representable DateTime."

like image 183
Cᴏʀʏ Avatar answered Sep 28 '22 02:09

Cᴏʀʏ