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.instBEqTimestamp = { beq := Std.Time.beqTimestamp✝ }
Equations
- Std.Time.instInhabitedTimestamp = { default := { val := default } }
Equations
- Std.Time.instLETimestamp = { le := fun (x y : Std.Time.Timestamp) => x.val ≤ y.val }
Equations
- Std.Time.instDecidableLeTimestamp = inferInstanceAs (Decidable (x.val ≤ y.val))
Equations
- Std.Time.instOfNatTimestamp = { ofNat := { val := OfNat.ofNat n } }
Equations
- Std.Time.instToStringTimestamp = { toString := fun (s : Std.Time.Timestamp) => toString s.val.toMilliseconds }
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 minutes as Minute.Offset
.
Equations
- tm.toMinutes = Std.Time.Internal.UnitVal.ediv tm.val.second 60
Instances For
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 Second.Offset
since the Unix epoch.
Equations
- Std.Time.Timestamp.ofSecondsSinceUnixEpoch secs = { val := Std.Time.Duration.ofSeconds secs }
Instances For
Creates a Timestamp
from a Nanosecond.Offset
since the Unix epoch.
Equations
- Std.Time.Timestamp.ofNanosecondsSinceUnixEpoch nanos = { val := Std.Time.Duration.ofNanoseconds nanos }
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
.
Equations
- t.addNanoseconds s = { val := t.val + Std.Time.Duration.ofNanoseconds s }
Instances For
Subtracts a Nanosecond.Offset
from the given Timestamp
.
Equations
- t.subNanoseconds s = { val := t.val - Std.Time.Duration.ofNanoseconds s }
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
.
Equations
- t.subSeconds s = { val := t.val - Std.Time.Duration.ofSeconds s }
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
.
Equations
- t.addHours h = { val := t.val + (Std.Time.Duration.ofSeconds ∘ Std.Time.Hour.Offset.toSeconds) h }
Instances For
Subtracts an Hour.Offset
from the given Timestamp
.
Equations
- t.subHours h = { val := t.val - (Std.Time.Duration.ofSeconds ∘ Std.Time.Hour.Offset.toSeconds) h }
Instances For
Adds a Day.Offset
to the given Timestamp
.
Equations
- t.addDays d = { val := t.val + (Std.Time.Duration.ofSeconds ∘ Std.Time.Day.Offset.toSeconds) d }
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
.
Instances For
Equations
- Std.Time.Timestamp.instHSubDuration_1 = { hSub := fun (x y : Std.Time.Timestamp) => x.val - y.val }