filesystem.clock

local clock = require('filesystem').clock

A clock to represent file time. Its epoch is unspecified.

Functions

now() → clock.time_point

Returns a new time point representing the current value of the clock.

epoch() → clock.time_point

Returns a new time point representing the epoch of the clock.

unix_epoch() → clock.time_point

Returns a new time point representing 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970.

from_system(tp: time.system_clock.time_point) → clock.time_point

Converts tp to a clock.time_point representing the same point in time.

time_point functions

add(self, secs: number)

Modifies the time point by the given duration.

When the duration is converted to the native tick representation of the clock, it’ll be rounded to the nearest time point rounding to even in halfway cases.

sub(self, secs: number)

Modifies the time point by the given duration.

When the duration is converted to the native tick representation of the clock, it’ll be rounded to the nearest time point rounding to even in halfway cases.

to_system(self) → time.system_clock.time_point

Converts self to a time.system_clock.time_point representing the same point in time.

time_point properties

seconds_since_epoch: number

The number of elapsed seconds since the clock’s epoch.

time_point metamethods

  • __add()

  • __sub()

  • __eq()

  • __lt()

  • __le()