Represents an exact point in time as a UNIX Epoch timestamp.
- val : Std.Time.Duration
Duration since the unix epoch.
Instances For
Equations
- Std.Time.instReprTimestamp = { reprPrec := Std.Time.reprTimestamp✝ }
Equations
- Std.Time.instLETimestamp = { le := fun (x y : Std.Time.Timestamp) => x.val ≤ y.val }
Equations
- Std.Time.instReprTimestamp_1 = { reprPrec := fun (s : Std.Time.Timestamp) => reprPrec (toString s) }
Fetches the current duration from the system.
Converts a Timestamp
to days as Day.Offset
.
Equations
- tm.toDays = Std.Time.Internal.UnitVal.ediv tm.val.second 86400
Instances For
Creates a Timestamp
from a Nanosecond.Offset
since the Unix epoch.
Instances For
Creates a Timestamp
from a Millisecond.Offset
since the Unix epoch.
Equations
- Std.Time.Timestamp.ofMillisecondsSinceUnixEpoch milli = { val := Std.Time.Duration.ofNanoseconds milli.toNanoseconds }
Instances For
Converts a Timestamp
to nanoseconds as Nanosecond.Offset
.
Equations
- tm.toNanosecondsSinceUnixEpoch = Std.Time.Internal.UnitVal.mul tm.toSecondsSinceUnixEpoch 1000000000 + { val := tm.val.nano.val }
Instances For
Converts a Timestamp
to nanoseconds as Millisecond.Offset
.
Equations
- tm.toMillisecondsSinceUnixEpoch = tm.toNanosecondsSinceUnixEpoch.toMilliseconds
Instances For
Calculates the duration from the given Timestamp
to the current time.
Equations
- f.since = do let cur ← Std.Time.Timestamp.now pure (cur.val.sub f.val)
Instances For
Adds a Millisecond.Offset
to the given Timestamp
.
Instances For
Subtracts a Millisecond.Offset
from the given Timestamp
.
Instances For
Adds a Nanosecond.Offset
to the given Timestamp
.
Instances For
Subtracts a Nanosecond.Offset
from the given Timestamp
.
Instances For
Adds a Second.Offset
to the given Timestamp
.
Equations
- t.addSeconds s = { val := t.val + Std.Time.Duration.ofSeconds s }
Instances For
Subtracts a Second.Offset
from the given Timestamp
.
Instances For
Adds a Minute.Offset
to the given Timestamp
.
Equations
- t.addMinutes m = { val := t.val + (Std.Time.Duration.ofSeconds ∘ Std.Time.Minute.Offset.toSeconds) m }
Instances For
Subtracts a Minute.Offset
from the given Timestamp
.
Equations
- t.subMinutes m = { val := t.val - (Std.Time.Duration.ofSeconds ∘ Std.Time.Minute.Offset.toSeconds) m }
Instances For
Adds an Hour.Offset
to the given Timestamp
.
Instances For
Subtracts an Hour.Offset
from the given Timestamp
.
Instances For
Adds a Day.Offset
to the given Timestamp
.
Instances For
Subtracts a Day.Offset
from the given Timestamp
.
Equations
- t.subDays d = { val := t.val - (Std.Time.Duration.ofSeconds ∘ Std.Time.Day.Offset.toSeconds) d }
Instances For
Adds a Week.Offset
to the given Timestamp
.
Equations
- t.addWeeks d = { val := t.val + (Std.Time.Duration.ofSeconds ∘ Std.Time.Day.Offset.toSeconds ∘ Std.Time.Week.Offset.toDays) d }
Instances For
Subtracts a Week.Offset
from the given Timestamp
.
Equations
- t.subWeeks d = { val := t.val - (Std.Time.Duration.ofSeconds ∘ Std.Time.Day.Offset.toSeconds ∘ Std.Time.Week.Offset.toDays) d }
Instances For
Adds a Duration
to the given Timestamp
.
Instances For
Subtracts a Duration
from the given Timestamp
.