Skip to content
FutureBlitz

    Install

    Import std.time.timers

    Deadline

    std.time.timers

    struct

    Public Struct Deadline Implements Comparable, Hashable, Defaultable

    A time to give up at, on the monotonic clock, as blocking calls take one; or none, which is every Deadline's zero.

    Examples

    Local start = Instant.FromNanoseconds(0)
    Local deadline = Deadline.After(2.Seconds, start)
    Expect(deadline.RemainingAt(start + 500.Milliseconds) == 1500.Milliseconds)
    Expect(deadline.HasPassedAt(start + 2.Seconds) && !deadline.HasPassedAt(start))
    Expect(deadline < Deadline.Never() && Deadline.Never().IsNever)

    std/time/timers.fb, line 103

    • Public Static Method After(time: Duration): Deadline static method #

      That long after now, or after the Instant. One too far to count is none.

    • Public Static Method After(time: Duration, now: Instant): Deadline static method #

      That long after now. One too far to count is none.

    • Public Static Method At(time: Instant): Deadline static method #

      At the Instant.

    • Public Static Method Never(): Deadline static method #

      None: it never passes.

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

      None, which never passes, as Never gives.

    • Public Property IsNever: Bool property #

      Whether it's none, which never passes.

    • Public Property Remaining: Duration property #

      How long is left before it, now or at the Instant: 0 once it's passed, and the longest Duration for none.

    • Public Method RemainingAt(now: Instant): Duration method #

      How long is left before it at now: 0 once it's passed, and the longest Duration for none.

    • Public Property HasPassed: Bool property #

      Whether it's passed, now or at the Instant.

    • Public Method HasPassedAt(now: Instant): Bool method #

      Whether it's passed at now.

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

      The earlier Deadline is the lesser; none is after every time.

    • Operator ==(a: Deadline, b: Deadline): Bool operator #

      As == goes, two Deadlines of none are the same, whatever their time.

    • Public Method Hash(): UInt64 method #

      A hash of its time, or 0 for none, which Deadlines that are equal share.

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