Opened 16 months ago

Last modified 10 days ago

#17925 assigned enhancement

Support leap seconds

Reported by: Don-vip Owned by: Don-vip
Priority: normal Milestone:
Component: Core Version:
Keywords: date time leap second utc gps sotmfr2019 Cc: StephaneP

Description (last modified by Don-vip)

RTKLib Positioning Solution File (.pos) support has been added in #17829.

Right now JOSM considers date are expressed in UTC but in fact they're using GPS time.

They currently differ by 18 seconds (number of leap seconds added to UTC since 1980 UTC-GPS synchronization).

It's not easy to support leap seconds in Java because Java date/time classes don't support them.

The only Java libraries that support leap seconds are Time4J and threeten-extra.

Attachments (0)

Change History (15)

comment:1 Changed 16 months ago by Don-vip

Cc: StephaneP added

comment:2 Changed 16 months ago by Don-vip

Description: modified (diff)

comment:4 Changed 16 months ago by Don-vip

Description: modified (diff)

comment:5 Changed 16 months ago by Don-vip

Description: modified (diff)

comment:6 Changed 15 months ago by stoecker

Supporting leap seconds means constant updates every half year. Is this really necessary for JOSM?

comment:7 Changed 15 months ago by Don-vip

Why half year? The latest leap second has been added in 2016.

comment:8 Changed 15 months ago by stoecker

Leap seconds may or may not be added at 30.06. or 31.12. each year. It is not deterministic and announced approx. 6 months before by the IERS ( So to make it right we need to create another admin task to get and check these announcements and update JOSM when necessary.

And all that for a value, which has no real meaning for JOSM.

comment:9 Changed 15 months ago by Don-vip

We have a new major Java version every 6 months. The workload of checking if we must add a +1 in a text file is nothing compared to that. And it has a meaning for users like Stéphane. The coding part involves some work, but the maintenance is insignificant.

comment:10 Changed 15 months ago by stoecker

Coding is easy. Store the files like this and simply apply the value of leap seconds:

comment:11 Changed 15 months ago by stoecker

Algorithm for GPS conversion:

  • Parse the list reverse (last entry first)
    • when date_to_fix >= leapdate+86400+leapseconds-19, subtract the leap seconds-19, done
    • if not try previous entry

Usually the last value is correct, so only one check is done.

Optimization: When parsing the file, already store date as "leapdata+86400+leapseconds-19" and the leap as "leap-19".

NOTE: Leap seconds may be negative or positive. That means either 23:59:59 is missing or 23:59:60 exists. ATM leaps have always been positive.

Above link can be used as data base. It will be updated by me as long as I'm responsible for the software using it.

comment:12 Changed 14 months ago by anonymous

Just FYI, leap seconds can also be introduced in March and September (, but given the current interval rate it's highly unlikely that will happen anytime soon.

comment:13 Changed 14 months ago by Don-vip

Milestone: 19.0819.09

comment:14 Changed 13 months ago by Don-vip

Milestone: 19.09

comment:15 Changed 10 days ago by simon04

Ticket #19932 has been marked as a duplicate of this ticket.

Modify Ticket

Change Properties
Set your email in Preferences
as assigned The owner will remain Don-vip.
as The resolution will be set.
to The owner will be changed from Don-vip to the specified user.
The owner will change to Don-vip
as duplicate The resolution will be set to duplicate.The specified ticket will be cross-referenced with this ticket

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.