Modify

Opened 4 years ago

Last modified 2 years 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 (18)

comment:1 Changed 4 years ago by Don-vip

Cc: StephaneP added

comment:2 Changed 4 years ago by Don-vip

Description: modified (diff)

comment:4 Changed 4 years ago by Don-vip

Description: modified (diff)

comment:5 Changed 4 years ago by Don-vip

Description: modified (diff)

comment:6 Changed 4 years ago by stoecker

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

comment:7 Changed 4 years ago by Don-vip

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

comment:8 Changed 4 years 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 (https://www.iers.org/SharedDocs/News/EN/BulletinC.html). 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 4 years 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 4 years ago by stoecker

Coding is easy. Store the files like this and simply apply the value of leap seconds: https://update.gnssonline.eu/leapseconds.cfg

comment:11 Changed 4 years 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 4 years ago by anonymous

Just FYI, leap seconds can also be introduced in March and September (https://www.iers.org/IERS/EN/Science/EarthRotation/UTC.html), but given the current interval rate it's highly unlikely that will happen anytime soon.

comment:13 Changed 4 years ago by Don-vip

Milestone: 19.0819.09

comment:14 Changed 4 years ago by Don-vip

Milestone: 19.09

comment:15 Changed 2 years ago by simon04

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

comment:16 Changed 2 years ago by simon04

The OpenJDK build includes the following file related to leap seconds from tzdata: https://github.com/openjdk/jdk/blob/master/make/data/tzdata/leapseconds

On GNU/Linux, the file is available under /usr/share/zoneinfo/leapseconds (Fedora).

For good test cases see ticket:17829#comment:19

comment:17 Changed 2 years ago by skyper

This file is part of the package tzdata and the file name is a bit different on Debian:

-rw-r--r-- 1 root root 10666 Jan  9 19:59 /usr/share/zoneinfo/leap-seconds.list

comment:18 Changed 2 years ago by Don-vip

Not sure we can rely on OS here. Windows has limited leap second support. It seems it can handle future leap seconds fine, but I can't retrieve past ones (before june 2018) using their tool:

w32tm /leapseconds /getstatus /verbose

[Secondes intercalaires]
Activé : 1 (Local)
Nombre de secondes intercalaires (après juin 2018) : 0 (local)
Liste des secondes intercalaires (local) :

Or maybe we can ship the list of leap seconds for the 1980-2018 period and rely on OS after that (need to check macOS support too).

Modify Ticket

Change Properties
Set your email in Preferences
Action
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.