Skip to content
Snippets Groups Projects
  1. Oct 19, 2021
    • Patrick Baumann's avatar
      Consolidating PM owner definition and adding new owners. · 8255f5f4
      Patrick Baumann authored
      Change-Id: If4b080755701452c53d55f26380e887dc3944dbf
      8255f5f4
    • Treehugger Robot's avatar
      Merge changes I6d3584f3,Ifdaada39 · f637a0d6
      Treehugger Robot authored
      * changes:
        Fix SntpClient 2036 issue (2/2)
        Fix SntpClient 2036 issue (1/2)
      f637a0d6
    • Neil Fuller's avatar
      Fix SntpClient 2036 issue (2/2) · c9bbe6b5
      Neil Fuller authored
      Fix issue with SntpClient after the end of NTP era 0 (2036).
      
      This is the second of two commits. This commit makes the actual fixes
      and makes tests pass.
      
      Before this change SntpClient converted to Unix epoch times too eagerly.
      NTP 64-bit timestamps are lossy: they only hold the number of seconds /
      factions of seconds in the NTP era and the era is not transmitted. The
      existing code assumed the era was always era 0, which ends in 2036.
      
      As explained at https://www.eecis.udel.edu/~mills/y2k.html,
      the lossiness of the type is not an issue providing that the maths is
      implemented carefully: the NTP timestamps are only ever subtracted from
      each other, are always assumed to be in the same or adjacent NTP eras,
      and are used to calculate offsets that are applied to client Unix epoch
      times.
      
      This commit:
      
      + Switches to use a dedicated Timestamp64 type, avoiding the use
      of the Unix epoch.
      + Switches to use a dedicated Duration64 type for holding the
      32-bit signed difference between two Timestamp64 instances.
      + Simplifies the readTimeStamp() and writeTimeStamp() methods.
      + Adds missing validation covered by a TODO. The code was randomizing
      the lower bits of the client transmit timestamp, but then not checking
      the result as it should, presumably because it was difficult to know
      what value was sent. Easily fixed with a dedicated type.
      + Stops randomizing the lower bits of various other timestamps
      unnecessarily.
      + Fixes some naming to add clarity.
      
      Bug: 199481251
      Test: atest core/tests/coretests/src/android/net/sntp/Timestamp64Test.java
      Test: atest core/tests/coretests/src/android/net/sntp/Duration64Test.java
      Test: atest core/tests/coretests/src/android/net/SntpClientTest.java
      Merged-In: I6d3584f318b0ef6ceab42bb88f20c73b0ad006cb
      Change-Id: I6d3584f318b0ef6ceab42bb88f20c73b0ad006cb
      c9bbe6b5
    • Neil Fuller's avatar
      Fix SntpClient 2036 issue (1/2) · f663ab42
      Neil Fuller authored
      Fix issue with SntpClient after the end of NTP era 0 (2036).
      
      This commit is 1/2. It makes some refactoring changes, lint fixes, adds
      tests and introduces types that will be used in 2/2. Some of the added
      tests fail and demonstrate the issue being fixed with the current
      implementation.
      
      -----
      
      Failures that demonstrate the bug:
      
      android.net.SntpClientTest#testRequestTime_era1ClientEra1Server
      
      STACKTRACE:
      junit.framework.AssertionFailedError: expected=5, actual=-4294967295995, allowedSlop=1
      	at junit.framework.Assert.fail(Assert.java:50)
      	at junit.framework.Assert.assertTrue(Assert.java:20)
      	at android.net.SntpClientTest.assertNearlyEquals(SntpClientTest.java:502)
      	at android.net.SntpClientTest.checkRequestTimeCalcs(SntpClientTest.java:215)
      	at android.net.SntpClientTest.testRequestTime_era1ClientEra1Server(SntpClientTest.java:201)
      
      android.net.SntpClientTest#testRequestTime_era0ClientEra1Server: FAILED (145ms)
      
      STACKTRACE:
      junit.framework.AssertionFailedError: expected=1139293696005, actual=-3155673599995, allowedSlop=1
      	at junit.framework.Assert.fail(Assert.java:50)
      	at junit.framework.Assert.assertTrue(Assert.java:20)
      	at android.net.SntpClientTest.assertNearlyEquals(SntpClientTest.java:502)
      	at android.net.SntpClientTest.checkRequestTimeCalcs(SntpClientTest.java:215)
      	at android.net.SntpClientTest.testRequestTime_era0ClientEra1Server(SntpClientTest.java:174)
      
      android.net.SntpClientTest#testNonMatchingOriginateTime: FAILED (116ms)
      
      STACKTRACE:
      junit.framework.AssertionFailedError
      	at junit.framework.Assert.fail(Assert.java:48)
      	at junit.framework.Assert.assertTrue(Assert.java:20)
      	at junit.framework.Assert.assertFalse(Assert.java:34)
      	at junit.framework.Assert.assertFalse(Assert.java:41)
      	at android.net.SntpClientTest.testNonMatchingOriginateTime(SntpClientTest.java:384)
      
      ------
      
      This commit:
      
      + Introduces a dedicated Timestamp64 type + test for holding NTP
      timestamps.
      + Introduces a dedicated Duration64 type + test for holding the
      32-bit signed difference between two Timestamp64 instances.
      + Fixes some naming to add clarity / addresses lint issues.
      + Adjusts tests
      
      Tests are NOT expected to pass with just this commit. See 2/2.
      
      Bug: 199481251
      Test: atest core/tests/coretests/src/android/net/sntp/Timestamp64Test.java
      Test: atest core/tests/coretests/src/android/net/sntp/Duration64Test.java
      Test: atest core/tests/coretests/src/android/net/SntpClientTest.java
      Merged-In: Ifdaada39298b05c48a3207fe6c0fad71c8a0a252
      Change-Id: Ifdaada39298b05c48a3207fe6c0fad71c8a0a252
      f663ab42
    • Ian Hua's avatar
      Merge "Add nnapi_native flag namespace." · bae244dd
      Ian Hua authored
      bae244dd
    • Treehugger Robot's avatar
    • Jakub Pawlowski's avatar
      10d9b01f
  2. Oct 18, 2021
  3. Oct 16, 2021
  4. Oct 15, 2021
  5. Oct 14, 2021
Loading