Namespace: joker.time
v1.0Provides functionality for measuring and displaying time.
Index
- add
- format
- from-unix
- hour
- hours
- microsecond
- millisecond
- minute
- minutes
- nanosecond
- now
- parse-duration
- round
- second
- seconds
- since
- sleep
- string
- sub
- truncate
- unix
- until
-
add
Function v1.0(add t d)
Returns the time t+d.
-
format
Function v1.0(format t layout)
Returns a textual representation of the time value formatted according to layout,
which defines the format by showing how the reference time, defined to be
Mon Jan 2 15:04:05 -0700 MST 2006
would be displayed if it were the value; it serves as an example of the desired output.
The same display rules will then be applied to the time value.. -
from-unix
Function v1.0(from-unix sec nsec)
Returns the local Time corresponding to the given Unix time, sec seconds and
nsec nanoseconds since January 1, 1970 UTC. It is valid to pass nsec outside the range [0, 999999999]. -
hour
Int v1.0Number of nanoseconds in 1 hour
source -
hours
Function v1.0(hours d)
Returns the duration (passed as a number of nanoseconds) as a floating point number of hours.
-
microsecond
Int v1.0Number of nanoseconds in 1 microsecond
source -
millisecond
Int v1.0Number of nanoseconds in 1 millisecond
source -
minute
Int v1.0Number of nanoseconds in 1 minute
source -
minutes
Function v1.0(minutes d)
Returns the duration (passed as a number of nanoseconds) as a floating point number of minutes.
-
nanosecond
Int v1.0Number of nanoseconds in 1 nanosecond
source -
now
Function v1.0(now)
Returns the current local time.
-
parse-duration
Function v1.0(parse-duration s)
Parses a duration string. A duration string is a possibly signed sequence of decimal numbers,
each with optional fraction and a unit suffix, such as 300ms, -1.5h or 2h45m. Valid time units are
ns, us (or µs), ms, s, m, h. -
round
Function v1.0(round d m)
Returns the result of rounding d to the nearest multiple of m. d and m represent time durations in nanoseconds.
The rounding behavior for halfway values is to round away from zero. If m <= 0, returns d unchanged. -
second
Int v1.0Number of nanoseconds in 1 second
source -
seconds
Function v1.0(seconds d)
Returns the duration (passed as a number of nanoseconds) as a floating point number of seconds.
-
since
Function v1.0(since t)
Returns the time in nanoseconds elapsed since t.
-
sleep
Function v1.0(sleep d)
Pauses the execution thread for at least the duration d (expressed in nanoseconds).
A negative or zero duration causes sleep to return immediately. -
string
Function v1.0(string d)
Returns a string representing the duration in the form 72h3m0.5s.
-
sub
Function v1.0(sub t u)
Returns the duration t-u in nanoseconds.
-
truncate
Function v1.0(truncate d m)
Returns the result of rounding d toward zero to a multiple of m. If m <= 0, returns d unchanged.
-
unix
Function v1.0(unix t)
Returns t as a Unix time, the number of seconds elapsed since January 1, 1970 UTC.
-
until
Function v1.0(until t)
Returns the duration in nanoseconds until t.