Time Provider

The Time Provider gets its actual time from different sources: NTP server, GPS satellite time or the standard system clock to offer a high precision time.
It automatically selects the best source to provide a really precise clock.

Note
According to many tests we made with different watches and devices, the standard Android system clock may not be very precise.
Depending on the vendor, OS implementation and internal sync interval, deviations up to 1.5 seconds compared to atomic time has been observed.
If this is not acceptable, use this provider.

Configuration

  • NTP Settings

    • Use NTP as Time Source
      Enabled to query the list of NTP servers for time synchronization.

    • Sync Interval
      The NTP server sync interval time, like 4h or 12h. A good default value is to query every 4 hours to keep the provider in sync.

    • NTP Server List
      A list of (S)NTP time server hosts to query. This list is used from top to bottom, if the first server on the list can’t be reached, the next one is taken as fallback.

      Note
      The tyckr project provides its own Stratum 2 NTP server at time.tyckr.io as an alternative time server.
      Access is anonymous and not logged.
  • GPS Settings

    • Use GPS as Time Source
      Enable to use GPS location information as time source.
      This is useful if no network for NTP sync is available. Using the time of the satellite onboard atomic clocks, this time source is fairly precise as well.

      Important
      GPS needs the location access permission to work.
  • System Clock Settings

    • Use System Clock
      Enable to get the time from the system clock. As mentioned above, this clock may not have a high precision.

Important
If NTP and GPS are enabled, the time source with the best status is used.
If the status of NTP and GPS is equal, NTP is preferred. System Clock is only taken, if it’s enabled and no other source is available (disabled or has a failed status).

@NOTE: If the time can’t be obtained and is invalid, all according queries below return NaN or an empty text.

Query

  • Time
    Returns the actual time.

    Text Numeric

    Time in the format specified by Param 2

    Milliseconds since 1970-01-01 00:00:00 UTC + Timezone of Param 1

    Numerically representation is given in milliseconds since epoch (1970-01-01) plus the timezone offset of Param 1.

    • Param 1
      Sets the timezone in which the time is given.

      System Default

      Uses the system timezone. This is normally the (automatically adjusted) timezone in which the device is currently located.

      Timezone like 'Europe/Berlin'

      Setup a custom timezone for the time.

    • Param 2
      The time format of the text representation. See Time Format for details.
      If empty, the default ISO format yyyy-MM-dd’T’HH:mm:ss.SSSxxx is used.

  • Epoch-Time
    Returns the Unix epoch time in milliseconds.
    These are the milliseconds since 1970-01-01 00:00:00.

  • System Timezone
    The local system timezone name like Europe/Berlin.
    This is normally the (automatically adjusted) timezone in which the device is currently located.

  • Timezone Offset to UTC
    The local system timezone offset to UTC in Seconds.

  • Date
    The date in form of 2023-10-25.

  • Year
    Numeric year value like 2023.

  • Month
    Numeric month value of 1-12 like 3.

  • Day
    Numeric day value of 1-31 like 11.

  • Weekday
    Monday: 1, Tuesday: 2, …​ Sunday: 7.

  • Is PM
    AM: 0, PM: 1

  • Hours (24)
    Numeric hours value of 0-23 in 24-hour format.

  • Hours (12)
    Numeric hours value of 1-12 in 12-hour format.

  • Minutes
    Numeric minutes value of 0-59 like 56.

  • Seconds
    Numeric seconds value of 0-59 like 45.

  • Milliseconds
    Numeric milliseconds value 0-999 like 311.

  • Time of Last Sync
    The time of the last successful sync of the actual selected time source.
    If the system clock is the actual source, the device boot time is returned, as synchronization of the system clock is done by the OS in background.

    • Param 1
      Sets the timezone in which the time is given.

    • Param 2
      The time format of the text representation. See Time Format for details.
      If empty, the default ISO format yyyy-MM-dd’T’HH:mm:ss.SSSxxx is used.

  • Deviation to System Time
    Returns the deviation of the time provided compared to the system clock im milliseconds.
    If the system clock is behind the provided time, deviation is positive.

  • Time Source
    Returns the name or value of the actual selected time source:

    Name Numeric Description

    NONE

    0

    No source selected

    SYS

    1

    System Clock

    GPS

    2

    GPS

    NTP

    3

    NTP

  • Sync Status
    Returns the status of the currently selected time source.
    If NTP is selected:

    Text Numeric Description

    N/A

    0

    No sync, no time available

    Excellent

    1

    Sync happened in 2x sync interval.

    Good

    2

    Sync happened in 3x sync interval.

    Fair

    3

    Sync happened in 6x sync interval.

    Poor

    4

    Sync happened in 12x sync interval.

    Fail

    5

    Sync happened, but long time ago.

    If GPS is selected:

    Text Numeric Description

    N/A

    0

    No sync, no time available

    Excellent

    1

    Sync happened in the last 8 hours.

    Good

    2

    Sync happened in the last 12 hours.

    Fair

    3

    Sync happened in the last 24 hours.

    Poor

    4

    Sync happened in the last 48 hours.

    Fail

    5

    Sync happened, but long time ago.

    If System Clock is selected:

    Text Numeric Description

    Good

    2

    System Clock is always considered good.