Skip to main content
Version: Current

Time Actions

  • os.agreedUponTime: number

    Gets the shared time that has been agreed upon between devices in the inst as the number of miliseconds since midnight January 1st, 1970 UTC-0 (i.e. the Unix Epoch). This is what your device's clock thinks the inst clock says.

    If an agreed upon time cannot be determined (for example, because collaboration is disabled in the inst), then this value will always be NaN.

    Examples
    Toast the current shared time
    os.toast(os.agreedUponTime);
  • os.deadReckoningTime: number

    Gets the shared time that has been agreed upon between devices but with an additional 50ms offset added. This offset attempts to ensure that changes/events will be recieved by all connected devices by the time it occurs, thereby making synchronized actions easier to perform.

    If an agreed upon time cannot be determined (for example, because collaboration is disabled in the inst), then this value will always be NaN.

  • os.instLatency: number

    Gets the average latency between this device's clock and the inst clock in miliseconds. Lower values tend to indicate a good connection while higher values tend to indicate a bad connection.

    If an agreed upon time cannot be determined (for example, because collaboration is disabled in the inst), then this value will always be NaN.

  • os.instTimeOffset: number

    Gets the calculated time offset between the inst clock and the local clock. This value is equivalent to os.agreedUponTime - os.localTime.

    If an agreed upon time cannot be determined (for example, because collaboration is disabled in the inst), then this value will always be NaN.

  • os.instTimeOffsetSpread: number

    Gets the spread between calculated time offsets. Higher values indicate that os.agreedUponTime is less accurate. Lower values indicate that os.agreedUponTime is more accurate.

    If an agreed upon time cannot be determined (for example, because collaboration is disabled in the inst), then this value will always be NaN.

  • os.localTime: number

    Gets the device-local time as the number of miliseconds since midnight January 1st, 1970 UTC-0 (i.e. the Unix Epoch). This is what your device's clock thinks the current time is.

    Examples
    Toast the number of miliseconds since the Unix Epoch
    os.toast(os.localTime);