Skip to content
FutureBlitz

    Install

    Import std.time.clock

    Instant

    std.time.clock

    struct

    Public Struct Instant Implements Comparable, Hashable, Printable, Defaultable

    A reading of the monotonic clock: nanoseconds since a moment of its own, which only means something beside the program's other Instants.

    Examples

    Local start = Instant.FromNanoseconds(1_000)
    Local later = start + 2.Seconds
    Expect(later - start == 2.Seconds && start < later)
    Expect(Instant.Now().Elapsed >= Duration.Zero())

    std/time/clock.fb, line 28

    • Public Static Method Now(): Instant static method #

      Now, as the clock counts it.

    • Public Static Method FromNanoseconds(count: Int64): Instant static method #

      The Instant that many nanoseconds after the clock's start, for code that gives the time.

    • Public Static Method DefaultValue(): Instant static method #

      The clock's reading of 0 nanoseconds.

    • Public Property Nanoseconds: Int64 property #

      How many nanoseconds after the clock's start it is.

    • Public Property Elapsed: Duration property #

      How long it's been since it, now.

    • @PanicsAtCaller Operator +(a: Instant, b: Duration): Instant operator #

      b after a. Past what an Int64 of nanoseconds holds, about 292 years, it overflows as an Int64 does.

    • @PanicsAtCaller Operator -(a: Instant, b: Duration): Instant operator #

      b before a. Past what an Int64 of nanoseconds holds, about 292 years, it overflows as an Int64 does.

    • @PanicsAtCaller Operator -(a: Instant, b: Instant): Duration operator #

      How long it is from b to a. Past what an Int64 of nanoseconds holds, about 292 years, it overflows as an Int64 does.

    • Operator <(a: Instant, b: Instant): Bool operator #

      Whether a is before b.

    • Public Method ToString(): String method #

      How long after the clock's start it is, like "1h2m3.5s".

    Report an issue with this page or with FutureBlitz on GitHub.