How can a 1 year old (java) lib correctly perform an UTC Time formatting, considering a newly introduced leap second

后端 未结 5 1787

A timestamp expressed in milliseconds since 1.1.1970 UTC is a common way to store timestamps, e.g in Java.

e.g:

long timestampUtc = System.currentTim         


        
5条回答
  •  攒了一身酷
    2021-01-11 10:48

    We ran into this with C# on Windows as well using .NET's DateTime class: It does not take leap seconds into account even though the MSDN documentation appears to imply otherwise.

    We decided to continue along with this as a known issue. One day, to work around this problem, we're planning on going back and adding something like a database table or a configuration file that can be updated in June/July and December/January to support and allow tweaking of the offset value to let us know today is exactly so many seconds--correctly accounted for leap seconds.

    If anyone has any other bright ideas in C# or Java, we'd love to hear them. Thanks.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题