Represents a time interval with nanoseconds precision.
- second : Std.Time.Second.Offset
Second offset of the duration.
- nano : Std.Time.Nanosecond.Span
Nanosecond span that ranges from -999999999 and 999999999
Instances For
Equations
- Std.Time.instReprDuration = { reprPrec := Std.Time.reprDuration✝ }
Equations
- One or more equations did not get rendered due to their size.
Equations
- Std.Time.instToStringDuration.leftPad n s = "".pushn '0' (n - s.length) ++ s
Instances For
Equations
- Std.Time.instReprDuration_1 = { reprPrec := fun (s : Std.Time.Duration) => reprPrec (toString s) }
Equations
- Std.Time.instBEqDuration = { beq := fun (x y : Std.Time.Duration) => x.second == y.second && y.nano == x.nano }
Equations
- One or more equations did not get rendered due to their size.
Equations
- Std.Time.instOfNatDuration = { ofNat := { second := Std.Time.Second.Offset.ofInt ↑n, nano := ⟨0, Std.Time.instOfNatDuration.proof_1⟩, proof := ⋯ } }
Negates a Duration
, flipping its second and nanosecond values.
Equations
- duration.neg = { second := -duration.second, nano := Std.Time.Internal.Bounded.LE.neg duration.nano, proof := ⋯ }
Instances For
Creates a new Duration
out of Second.Offset
.
Equations
- Std.Time.Duration.ofSeconds s = { second := s, nano := ⟨0, Std.Time.Duration.ofSeconds.proof_1⟩, proof := ⋯ }
Instances For
Creates a new Duration
out of Nanosecond.Offset
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Checks if the duration is zero seconds and zero nanoseconds.
Instances For
Converts a Duration
to a Millisecond.Offset
Equations
- duration.toMilliseconds = Std.Time.Internal.UnitVal.mul duration.second 1000 + { val := (Std.Time.Internal.Bounded.LE.ediv duration.nano 1000000 Std.Time.Duration.toMilliseconds.proof_1).val }
Instances For
Converts a Duration
to a Nanosecond.Offset
Equations
- duration.toNanoseconds = Std.Time.Internal.UnitVal.mul duration.second 1000000000 + { val := duration.nano.val }
Instances For
Equations
- Std.Time.Duration.instLE = { le := fun (d1 d2 : Std.Time.Duration) => d1.toNanoseconds ≤ d2.toNanoseconds }
Equations
- Std.Time.Duration.instDecidableLe = inferInstanceAs (Decidable (x.toNanoseconds ≤ y.toNanoseconds))
Converts a Duration
to a Minute.Offset
Equations
- tm.toMinutes = Std.Time.Internal.UnitVal.ediv tm.second 60
Instances For
Converts a Duration
to a Day.Offset
Equations
- tm.toDays = Std.Time.Internal.UnitVal.ediv tm.second 86400
Instances For
Normalizes Second.Offset
and NanoSecond.span
in order to build a new Duration
out of it.
Equations
- Std.Time.Duration.fromComponents secs nanos = Std.Time.Duration.ofNanoseconds (secs.toNanoseconds + nanos.toOffset)
Instances For
Adds two durations together, handling any carry-over in nanoseconds.
Equations
- t₁.add t₂ = Std.Time.Duration.ofNanoseconds (t₁.toNanoseconds + t₂.toNanoseconds)
Instances For
Adds a Nanosecond.Offset
to a Duration
Equations
- t.addNanoseconds s = t.add (Std.Time.Duration.ofNanoseconds s)
Instances For
Adds a Millisecond.Offset
to a Duration
Equations
- t.addMilliseconds s = t.add (Std.Time.Duration.ofNanoseconds s.toNanoseconds)
Instances For
Adds a Millisecond.Offset
to a Duration
Equations
- t.subMilliseconds s = t.sub (Std.Time.Duration.ofNanoseconds s.toNanoseconds)
Instances For
Adds a Nanosecond.Offset
to a Duration
Equations
- t.subNanoseconds s = t.sub (Std.Time.Duration.ofNanoseconds s)
Instances For
Adds a Second.Offset
to a Duration
Equations
- t.addSeconds s = t.add (Std.Time.Duration.ofSeconds s)
Instances For
Subtracts a Second.Offset
from a Duration
Equations
- t.subSeconds s = t.sub (Std.Time.Duration.ofSeconds s)
Instances For
Adds a Minute.Offset
to a Duration
Equations
- t.addMinutes m = t.addSeconds (Std.Time.Internal.UnitVal.mul m 60)
Instances For
Subtracts a Minute.Offset
from a Duration
Equations
- t.subMinutes m = t.subSeconds (Std.Time.Internal.UnitVal.mul m 60)
Instances For
Adds an Hour.Offset
to a Duration
Equations
- t.addHours h = t.addSeconds (Std.Time.Internal.UnitVal.mul h 3600)
Instances For
Subtracts an Hour.Offset
from a Duration
Equations
- t.subHours h = t.subSeconds (Std.Time.Internal.UnitVal.mul h 3600)
Instances For
Adds a Day.Offset
to a Duration
Equations
- t.addDays d = t.addSeconds (Std.Time.Internal.UnitVal.mul d 86400)
Instances For
Subtracts a Day.Offset
from a Duration
Equations
- t.subDays d = t.subSeconds (Std.Time.Internal.UnitVal.mul d 86400)
Instances For
Adds a Week.Offset
to a Duration
Equations
- t.addWeeks w = t.addSeconds (Std.Time.Internal.UnitVal.mul w 604800)
Instances For
Subtracts a Week.Offset
from a Duration
Equations
- t.subWeeks w = t.subSeconds (Std.Time.Internal.UnitVal.mul w 604800)
Instances For
Equations
- Std.Time.Duration.instHSub = { hSub := Std.Time.Duration.sub }
Equations
- Std.Time.Duration.instHAdd = { hAdd := Std.Time.Duration.add }
Equations
- Std.Time.Duration.instHMulInt = { hMul := fun (i : Int) (d : Std.Time.Duration) => Std.Time.Duration.ofNanoseconds (Std.Time.Nanosecond.Offset.ofInt (d.toNanoseconds.val * i)) }
Equations
- Std.Time.Duration.instHMulInt_1 = { hMul := fun (d : Std.Time.Duration) (i : Int) => Std.Time.Duration.ofNanoseconds (Std.Time.Nanosecond.Offset.ofInt (d.toNanoseconds.val * i)) }
Equations
- Std.Time.Duration.instHAddPlainTime = { hAdd := fun (pt : Std.Time.PlainTime) (d : Std.Time.Duration) => Std.Time.PlainTime.ofNanoseconds (d.toNanoseconds + pt.toNanoseconds) }
Equations
- Std.Time.Duration.instHSubPlainTime = { hSub := fun (pt : Std.Time.PlainTime) (d : Std.Time.Duration) => Std.Time.PlainTime.ofNanoseconds (d.toNanoseconds - pt.toNanoseconds) }