Import std.time.duration
std.time.duration
Duration: a span of time to the nanosecond, as an Int64 of them, from about 292 years before to 292 years after. An Int64's or a Double's Nanoseconds, Microseconds, Milliseconds, Seconds, Minutes, Hours, and Days make one, as 2.Seconds, 1.5.Minutes, and 500.Milliseconds do, a literal taking whichever has them; a Double's round to the nearest nanosecond, ties to even, and one longer than a Duration holds panics. Its operators add and subtract Durations, scale one by a number, and divide one by a number or another Duration. Wait and RealWait take one, and ToString and Parse write and read one as Go does, like "1h30m0s" and "1.5ms".
std/time/duration.fb
Types
Duration
struct
Public Struct Duration Implements Comparable, Hashable, Printable, Defaultable
A length of time, in nanoseconds, below 0 for one that goes back.
-
No time at all.
-
The value to start from, like 0 for a number, "" for a String, or an empty collection.
-
The longest Durations, about 292 years either way.
-
The shortest Duration, about 292 years back.
-
The Duration of that many nanoseconds.
-
Its nanoseconds, all of them.
-
It in microseconds, with a fraction for what's left: 1500 nanoseconds is 1.5.
-
It in milliseconds, with a fraction for what's left.
-
It in seconds, with a fraction for what's left.
-
It in minutes, with a fraction for what's left.
-
It in hours, with a fraction for what's left.
-
It in days, of 24 hours, with a fraction for what's left.
-
Whether it's no time at all.
-
Whether it goes back.
-
It without its sign. MinValue's has none that fits, so it panics.
-
It rounded toward 0 to a multiple of
unit, as 1h15m truncated to an hour is 1h. A unit that isn't above 0 leaves it as it is. -
It rounded to the nearest multiple of
unit, a half away from 0, as 1h30m rounded to an hour is 2h; past the longest Duration, it's the longest. A unit that isn't above 0 leaves it as it is. -
As Go writes it: hours, minutes, and seconds with a fraction, like "1h2m3.5s" and "2m0s", or below a second, one unit with a fraction, like "1.5ms", "250µs", and "80ns"; and "0s".
-
The Duration the
textis, as Go's ParseDuration reads it: a sign or none, then one or more numbers, each with a fraction or not and a unit, "ns", "us" (or "µs" or "μs"), "ms", "s", "m", or "h", as in "1h30m" and "-1.5s"; or "0". Other text, or a Duration longer than one holds, is Null. -
Whether
acomes beforeb.Doc from
std.core.interfaces.Comparable.Operator<. -
aplusb, which panics past the longest Durations, as an Int64's overflow does. -
aminusb, which panics past the longest Durations, as an Int64's overflow does. -
anegated, which panics past the longest Durations, as an Int64's overflow does. -
atimesb, exactly. One longer than a Duration holds panics, as an Int64's overflow does. -
atimesb, exactly. One longer than a Duration holds panics, as an Int64's overflow does. -
atimesb, exactly. One longer than a Duration holds panics, as an Int64's overflow does. -
atimesb, exactly. One longer than a Duration holds panics, as an Int64's overflow does. -
atimesb, exactly. One longer than a Duration holds panics, as an Int64's overflow does. -
atimesb, exactly. One longer than a Duration holds panics, as an Int64's overflow does. -
atimesb, exactly. One longer than a Duration holds panics, as an Int64's overflow does. -
atimesb, exactly. One longer than a Duration holds panics, as an Int64's overflow does. -
atimesb, exactly. One longer than a Duration holds panics, as an Int64's overflow does. -
atimesb, exactly. One longer than a Duration holds panics, as an Int64's overflow does. -
atimesb, exactly. One longer than a Duration holds panics, as an Int64's overflow does. -
atimesb, exactly. One longer than a Duration holds panics, as an Int64's overflow does. -
atimesb, exactly. One longer than a Duration holds panics, as an Int64's overflow does. -
atimesb, exactly. One longer than a Duration holds panics, as an Int64's overflow does. -
atimesb, to the nearest nanosecond, ties to even. One longer than a Duration holds panics, and so does abthat isn't a number. -
atimesb, to the nearest nanosecond, ties to even. One longer than a Duration holds panics, and so does anathat isn't a number. -
adivided byb, rounded toward 0. Dividing by 0 panics, as an Int's / does. -
adivided byb, rounded toward 0. Dividing by 0 panics, as an Int's / does. -
adivided byb, rounded toward 0. Dividing by 0 panics, as an Int's / does. -
adivided byb, rounded toward 0. Dividing by 0 panics, as an Int's / does. -
adivided byb, rounded toward 0. Dividing by 0 panics, as an Int's / does. -
adivided byb, rounded toward 0. Dividing by 0 panics, as an Int's / does. -
adivided byb, rounded toward 0. Dividing by 0 panics, as an Int's / does. -
adivided byb, to the nearest nanosecond, ties to even. Dividing by 0 panics, and so does abthat isn't a number. -
How many of
bfit ina, with a fraction. Dividing by abof 0 panics. -
What's left of
aoverb, witha's sign, as an Int's % has, which panics for abof 0.
Extends
Int64
extend
Extend Int64
No doc comment.
std/time/duration.fb, line 466
-
This many nanoseconds, as a Duration, as
5.Nanosecondsis. -
This many microseconds, as a Duration, as
5.Microsecondsis. Panics when it's longer than a Duration holds. -
This many milliseconds, as a Duration, as
5.Millisecondsis. Panics when it's longer than a Duration holds. -
This many seconds, as a Duration, as
5.Secondsis. Panics when it's longer than a Duration holds. -
This many minutes, as a Duration, as
5.Minutesis. Panics when it's longer than a Duration holds. -
This many hours, as a Duration, as
5.Hoursis. Panics when it's longer than a Duration holds. -
This many days, of 24 hours, as a Duration, as
5.Daysis. Panics when it's longer than a Duration holds.
Float64
extend
Extend Float64
No doc comment.
std/time/duration.fb, line 516
-
This many nanoseconds, to the nearest, as a Duration. Panics for NaN, an infinity, or one longer than a Duration holds.
-
This many microseconds, to the nearest nanosecond, as a Duration, as
1.5.Microsecondsis. Panics for NaN, an infinity, or one longer than a Duration holds. -
This many milliseconds, to the nearest nanosecond, as a Duration, as
1.5.Millisecondsis. Panics for NaN, an infinity, or one longer than a Duration holds. -
This many seconds, to the nearest nanosecond, as a Duration, as
1.5.Secondsis. Panics for NaN, an infinity, or one longer than a Duration holds. -
This many minutes, to the nearest nanosecond, as a Duration, as
1.5.Minutesis. Panics for NaN, an infinity, or one longer than a Duration holds. -
This many hours, to the nearest nanosecond, as a Duration, as
1.5.Hoursis. Panics for NaN, an infinity, or one longer than a Duration holds. -
This many days, to the nearest nanosecond, as a Duration, as
1.5.Daysis. Panics for NaN, an infinity, or one longer than a Duration holds.
Report an issue with this page or with FutureBlitz on GitHub.