Skip to content

One second off with pre epoch dates #894

Description

@elharo

second test below fails. This was probably introduced in #752

public void testEpoch() {
    assertParsedRfc3339(
        "1970-01-01T00:00:00.000Z", SecondsAndNanos.ofSecondsAndNanos(0, 0));
  }

  public void testOneSecondBeforeEpoch() {
    assertParsedRfc3339(
        "1969-12-31T23:59:59.000Z", SecondsAndNanos.ofSecondsAndNanos(-1, 0));
  }

Activity

  1. added
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Nov 25, 2019
  2. elharo commented on Nov 25, 2019

    @elharo
    ContributorAuthor

    For some reason line 404 of parseRfc3339WithNanoSeconds returns -553 for milliseconds for one second before the epoch, not -1000 or even -999.

  3. elharo commented on Nov 25, 2019

    @elharo
    ContributorAuthor

    Weird. This test not only fails, but fails with different values each time I run it:

      public void testDateTime() {  
    	Calendar dateTime = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
        dateTime.set(1969, 11, 31, 23, 59, 59);
        long value = dateTime.toInstant().toEpochMilli();
        assertEquals(-1000L, value);
      }
    
  4. suztomo commented on Dec 12, 2019

    @suztomo
    Member

    Memo: Affected versions:
    v1.31.0
    v1.32.0
    v1.32.1
    v1.32.2
    v1.33.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions