TimeReferenceNew · 0.744
Duration.TimeSinceEpoch
Read the current wall-clock duration since the epoch.
Details#
Returns the current wall-clock time as a Duration measured from the clock's epoch. Read fields such as Seconds or Milliseconds to select the unit. Wall-clock time can change when the system clock is adjusted. Use Stopwatch for measuring elapsed work rather than subtracting wall-clock readings.
Fields Duration#
| Field | Type | Meaning |
|---|---|---|
Nanoseconds | number | The total duration in nanoseconds, including a fractional part where applicable. |
Microseconds | number | The total duration in microseconds, including a fractional part where applicable. |
Milliseconds | number | The total duration in milliseconds, including a fractional part where applicable. |
Seconds | number | The total duration in seconds, including a fractional part where applicable. |
Minutes | number | The total duration in minutes, including a fractional part where applicable. |
Hours | number | The total duration in hours, including a fractional part where applicable. |
Days | number | The total duration in days, including a fractional part where applicable. |
Months | number | The total duration in months, including a fractional part where applicable. One month is the fixed average of 30.436875 days, not a calendar month. |
Years | number | The total duration in years, including a fractional part where applicable. One year is the fixed average of 365.2425 days, not a calendar year. |
Signature#
Duration.TimeSinceEpoch(): DurationReturns#
A Duration containing the current wall-clock reading.
Examples#
Local example
local now = Duration.TimeSinceEpoch()
print(now.Seconds)Notes#
- Each field reports the entire duration in that unit, not a separate component. For example, 90 seconds has Seconds = 90 and Minutes = 1.5.
- Fractional nanoseconds are discarded toward zero. Numeric results can lose precision for large durations, especially when reading nanoseconds. Use finite inputs and keep the converted duration within the supported numeric range.
- Months and years use fixed averages of 30.436875 and 365.2425 days. These values do not perform calendar arithmetic or account for varying month lengths.