leap-second

What does python return on the leap second

為{幸葍}努か 提交于 2021-02-18 20:56:23
问题 What does python time and datetime module return on the leap second? What will I get when we are at 23:59:60.5 if I call: time.time() datetime.datetime.utcnow() datetime.datetime.now(pytz.utc) Also, any difference between py2.7 and py3? Why it is confusing (at least for me): From the datetime docs I see: Unlike the time module, the datetime module does not support leap seconds. On the time docs I see there is "support" for leap seconds when parsing with strptime . But there is no comment

Duration with leap seconds

╄→尐↘猪︶ㄣ 提交于 2020-02-03 04:40:30
问题 I need to schedule a task in my code at a fixed datetime. For that I'm using a ScheduledExecutorService with the method schedule(Runnable command, long delay, TimeUnit unit); How can I compute this delay according to leap seconds ? For the moment I use Duration.between() but it doesn't seem aware of leap seconds: ZonedDateTime date1 = ZonedDateTime.of(2015, 06, 30, 23, 59, 59, 000000, ZoneOffset.UTC); ZonedDateTime date2 = ZonedDateTime.of(2015, 07, 01, 00, 00, 00, 000000, ZoneOffset.UTC);

Storing a leap second in SQL Server 2008

梦想的初衷 提交于 2019-12-21 03:43:19
问题 This weekend is an extra long one as there will be an extra second inserted after 23:59:59 on June 30th. We have a system that logs a lot of data around the clock and one of the business rules is that no two records can be logged as having occurred at the same time, to within one second. We're using UTC datetimes along with the new datetimeoffset data type, but as far as I can tell they won't let you have more than 60 seconds in a minute. Certainly, this throws an error: select datediff(ss,

Extract historic leap seconds from tzdata

六眼飞鱼酱① 提交于 2019-12-18 03:12:06
问题 Is there a way to extract the moment of historic leap seconds from the time-zone database that is distributed on most linux distributions? I am looking for a solution in python, but anything that works on the command line would be fine too. My use case is to convert between gps-time (which is basically the number of seconds since the first GPS-satellite was switched on in 1980) and UTC or local time. UTC is adjusted for leap-seconds every now and then, while gps-time increases linearly. This

Extract historic leap seconds from tzdata

拈花ヽ惹草 提交于 2019-12-18 03:11:19
问题 Is there a way to extract the moment of historic leap seconds from the time-zone database that is distributed on most linux distributions? I am looking for a solution in python, but anything that works on the command line would be fine too. My use case is to convert between gps-time (which is basically the number of seconds since the first GPS-satellite was switched on in 1980) and UTC or local time. UTC is adjusted for leap-seconds every now and then, while gps-time increases linearly. This

Python - Datetime not accounting for leap second properly?

纵饮孤独 提交于 2019-12-17 16:34:29
问题 I am parsing some data that has the leapsecond timestampe datetime 2012-06-30T23:59:60.209215 . I used following code to parse that string and convert to a datetime object: nofrag, frag = t.split('.') nofrag_dt = datetime.datetime.strptime(nofrag, "%Y-%m-%dT%H:%M:%S") dt = nofrag_dt.replace(microsecond=int(frag)) Python documentation claims that this shouldn't be an issue as %S accepts [0, 61] . But, I get this error with the above timestamp nofrag_dt = datetime.datetime.strptime(nofrag, "%Y-

How to get leap seconds from gps epoch for current date in python

自古美人都是妖i 提交于 2019-12-11 10:33:53
问题 As I understand for now in python there is no function to get leap seconds from gps epoch for current date. The appropriate patch under investigation/development: leap seconds path in datetime Could you advice the best way how to get leap seconds? I found that solution: def getLeapSec(Tgps): daysFromGPSEpoch = timedelta(seconds=Tgps).days tableLeapSec = ([ [0, 542, 907, 1272, 2003, 2917, 3648, 4013, 4560, 4925, 5290, 5839, 6386, 6935, 9492, 10588, 11865, 12960], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9,

Why does java tzupdater add leap seconds?

孤者浪人 提交于 2019-12-11 03:09:32
问题 There are some references mentioned that leap seconds are ignored by Java: How can a 1 year old (java) lib correctly perform an UTC Time formatting, considering a newly introduced leap second Do Java system milliseconds take account of leap seconds? JDK-4272347 : (cal/tz) support leap seconds ticket Yet the document Timezone Data Versions in the JRE Software mentions: New leap second 2015-06-30 23:59:60 UTC as per IERS Bulletin C 49. 3rd party Java library Time4J uses it's own list of leap

How to obtain current TAI time?

只愿长相守 提交于 2019-12-06 00:15:42
问题 How can I obtain the current TAI time in milliseconds in Linux using either Java or C++? The reason I need this is to be able to accurately take timestamps over a long period of time (on the order of years) and still be able to compare them, without worrying about leap seconds. It is possible for multiple measurements to take place during a leap second and all measurements need to be unambiguous, monotonically increasing, and linearly increasing. This will be a dedicated Linux server. This is

With the Win 10 Oct 2018 update, Windows is leap second aware. Is .NET's DateTime, too, now?

元气小坏坏 提交于 2019-12-04 17:00:25
In 2012, there was a question here on SO, whether .NET's DateTime are capable of recognizing leap seconds. [1] The answer was no. The documentation is still explicitly stating that it is not. [2] However, Windows Server 2019 and the Windows 10 October 2018 update made Windows itself leap second aware. [3] This begs the question: is .NET inherently leap second aware now? More specifically: can I make my DateTime structures leap second aware as well, by somehow opting in? Edit: From a MS Word document titled "Quest: Write a Leap Second Aware Application on Windows" [4] (emphasis by me): Known