JodaOrg / joda-time

Joda-Time is the widely used replacement for the Java date and time classes prior to Java SE 8.
http://www.joda.org/joda-time/
Apache License 2.0
4.98k stars 986 forks source link

13 seconds diff in <1912 Portuguese timestamps #732

Closed srsansano closed 1 year ago

srsansano commented 1 year ago

Key information

Problem description

According to Joda's documentation in https://joda-time.sourceforge.net/faq.html#wrongoffset, it states it makes use of IANA's timezone database. We are having an issue with Portuguese timestamps before 1912, as the official offset is described as GMT–00:36:45 in that database, which is consistent with Wikipedia article and legal documents from Portugal.

tzdata's snippet for Portugal under europe file:

# Zone  NAME        STDOFF  RULES   FORMAT  [UNTIL]
        #STDOFF -0:36:44.68
Zone    Europe/Lisbon   -0:36:45 -  LMT 1884
            -0:36:45 -  LMT 1912 Jan  1  0:00u # Lisbon MT

However, for that time period Joda seems to be using GMT–00:36:32, resulting in a 13 second difference to the expected.

Test case

        DateTime jodaDateTime = new DateTime(1911, 8, 2, 00, 00, 0, DateTimeZone.forID("Europe/Lisbon"));
        System.out.println(jodaDateTime.getMillis());

Output of the code above: -1843514608000

Enter that in https://www.epochconverter.com/ and the result is: GMT: Wednesday, 2 August 1911 00:36:32

srsansano commented 1 year ago

Fixed at some point in a Joda release. Maven was picking an old one from a different dependency.