Questions tagged [leap-second]

A leap second is a one-second adjustment that is occasionally applied to Coordinated Universal Time (UTC) in order to keep its time of day close to the mean solar time.

A leap second is a one-second adjustment that is occasionally applied to Coordinated Universal Time (UTC) in order to keep its time of day close to the mean solar time.

See http://en.wikipedia.org/wiki/Leap_second

46 questions
4
votes
2 answers

How to prove June 30th 2015 has 86401 seconds in Java 8 (new Date Time API)?

I try to prove June 30th 2015 has 86401 seconds, use Java code like this: Instant i1 = Instant.ofEpochSecond(longestDay.toEpochSecond(ZoneOffset.UTC)); Instant i2 = Instant.ofEpochSecond(oneDayAfter.toEpochSecond(ZoneOffset.UTC)); long d =…
Vy Do
  • 46,709
  • 59
  • 215
  • 313
3
votes
2 answers

How many seconds elapsed since 01/01/1970, leap-seconds included?

The Unix timestamp given by: int(time.time()) gives the number of seconds elapsed since 01/01/1970, without leap-seconds. Just out of curiosity, how to get the true number of seconds elapsed since this date, leap-seconds included? (i.e. the…
Basj
  • 41,386
  • 99
  • 383
  • 673
3
votes
2 answers

Leap seconds and std::chrono

I took a look att cppreference.org (emphasis mine): The clock std::chrono::utc_clock is a Clock that represents Coordinated Universal Time (UTC). It measures time since 00:00:00 UTC, Thursday, 1 January 1970, including leap seconds. Comparing that…
user877329
  • 6,717
  • 8
  • 46
  • 88
3
votes
1 answer

Formatting time4j moment

For one of the projects, I was given a millisecond from another system. I need to convert to "yyyy-DDDT:HH:mm:ssZ" The trick is to display it in leap-second. Since Java libraries does not have leap-second, I decided to use Time4J's Moment class.…
william
  • 7,284
  • 19
  • 66
  • 106
3
votes
1 answer

Parse and combine date and time (leap seconds) from strings - python

I parse a date (format: YYYY-MM-DD HH:MM:SS) from a data file which contains multiple lines of dates. The problem is that the data contains leap seconds so i'm not able to use datetime. How can I take into account the leap seconds (0-60), so that at…
greencup
  • 41
  • 3
3
votes
2 answers

Dealing with Leap Seconds Correctly

Before and during a leap second, it appears that calling new Date() will return 23:59:59 twice (once before the leap second, and once during the leap second), rather than 23:59:59, and 23:59:60. Is there a way (short of implementing an NTP client…
xirt
  • 514
  • 1
  • 6
  • 18
3
votes
1 answer

Java time ahead of linux time (leap second)

I have changed the Linux system date to Sat Jun 30 23:50:00 2012. After changing the date I am running a simple java program to log the system date. The problem is: Java is logging 25 seconds ahead of Linux system time. For example: Java log:…
3
votes
2 answers

Testing for leap seconds for a given time_t in Linux

Is there a simple way of determining how many (if any) leap seconds are applied for a given implementation of: time_t unix_seconds = mktime(&my_tm); For example, is there a field that is populated in my_tm? Otherwise, I suppose my option is test…
Damien
  • 785
  • 3
  • 8
  • 18
3
votes
1 answer

Leap Seconds and pthread_mutex_timedlock premature timeout

So just recently, my async server code which relies on pthread_mutex_timedlock seem to have timed out prematurely. I thought it was just my bug at first, but seeing that there was some leap seconds issues with the linux kernel, it seems that I'm not…
kamziro
  • 7,882
  • 9
  • 55
  • 78
2
votes
2 answers

Which libraries can count seconds correctly and for which dates?

Compute the number of SI seconds between “2021-01-01 12:56:23.423 UTC” and “2001-01-01 00:00:00.000 UTC” as example.
2
votes
1 answer

Why Java Unix time and Calendar calculate exact time?

I heard that Unix time does not include "Leap Second". And I also heard that Java Calendar API does not include Leap second. Since 1972, 27 seconds were added as the Leap second. And Unix time began 1970-01-01 00:00:00 (UTC). So, I thought that…
박찬준
  • 346
  • 1
  • 7
2
votes
0 answers

Why java.time.Instant doesn't show any leap seconds?

Edit below with summary of answer: I'm trying to understand a bit more about java.time.Instant and leap seconds. If I run this: System.out.println(Instant.ofEpochSecond(60*60*24*365*50)); I expected to create a time/date that's near the start of…
Toby Eggitt
  • 1,806
  • 19
  • 24
2
votes
2 answers

How to check if it's xx:00:00 with a timestamp?

It seems that checking if it's xx:00:00 UTC/GMT is as simple as checking if timestamp % 3600 == 0, with timestamp = number of seconds elapsed since epoch (1970-01-01 00:00:00). We can see it here: import datetime print…
Basj
  • 41,386
  • 99
  • 383
  • 673
2
votes
1 answer

Are leap seconds stored on Mac OS X anywhere?

I ran find /usr/share/zoneinfo/ -type f -exec file {} \; |grep -v 'no leap' on my system and every single time zone file said it had no leap seconds. Are leap seconds stored anywhere on mac OS X that I can get to in a robust way? I'm writing a…
Jason
  • 410
  • 2
  • 14
2
votes
1 answer

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

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…
Anton Protopopov
  • 30,354
  • 12
  • 88
  • 93