Namespace: joker.time
v1.0Contents
Summary
Provides functionality for measuring and displaying time.
Index
- add
- add-date
- ansi-c
- format
- from-unix
- hour
- hours
- in-timezone
- kitchen
- microsecond
- millisecond
- minute
- minutes
- nanosecond
- now
- parse
- parse-duration
- rfc1123
- rfc1123-z
- rfc3339
- rfc3339-nano
- rfc822
- rfc822-z
- rfc850
- round
- ruby-date
- second
- seconds
- since
- sleep
- stamp
- stamp-micro
- stamp-milli
- stamp-nano
- string
- sub
- truncate
- unix
- unix-date
- until
Legend
-
Constant
Variable
Function
Macro
Special form
Type
GoVar
Receiver/Method
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
ansi-c
String v1.0Mon Jan _2 15:04:05 2006
-
hour
BigInt v1.0Number of nanoseconds in 1 hour
-
kitchen
String v1.03:04PM
-
microsecond
Int v1.0Number of nanoseconds in 1 microsecond
-
millisecond
Int v1.0Number of nanoseconds in 1 millisecond
-
minute
BigInt v1.0Number of nanoseconds in 1 minute
-
nanosecond
Int v1.0Number of nanoseconds in 1 nanosecond
-
rfc1123
String v1.0Mon, 02 Jan 2006 15:04:05 MST
-
rfc1123-z
String v1.0Mon, 02 Jan 2006 15:04:05 -0700
-
rfc3339
String v1.02006-01-02T15:04:05Z07:00
-
rfc3339-nano
String v1.02006-01-02T15:04:05.999999999Z07:00
-
rfc822
String v1.002 Jan 06 15:04 MST
-
rfc822-z
String v1.002 Jan 06 15:04 -0700
-
rfc850
String v1.0Monday, 02-Jan-06 15:04:05 MST
-
ruby-date
String v1.0Mon Jan 02 15:04:05 -0700 2006
-
second
Int v1.0Number of nanoseconds in 1 second
-
stamp
String v1.0Jan _2 15:04:05
-
stamp-micro
String v1.0Jan _2 15:04:05.000000
-
stamp-milli
String v1.0Jan _2 15:04:05.000
-
stamp-nano
String v1.0Jan _2 15:04:05.000000000
-
unix-date
String v1.0Mon Jan _2 15:04:05 MST 2006
Variables
-
(None.)
Functions, Macros, and Special Forms
-
add
Function v1.0(add t d)
Returns the time t+d.
-
add-date
Function v1.0(add-date t years months days)
Returns the time t + (years, months, days).
-
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]. -
hours
Function v1.0(hours d)
Returns the duration (passed as a number of nanoseconds) as a floating point number of hours.
-
in-timezone
Function v1.0(in-timezone t tz)
Returns a copy of t representing the same time instant, but with the copy's timezone information set to tz for display purposes.
-
minutes
Function v1.0(minutes d)
Returns the duration (passed as a number of nanoseconds) as a floating point number of minutes.
-
now
Function v1.0(now)
Returns the current local time.
-
parse
Function v1.0(parse layout value)
Parses a time string.
-
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. -
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.
Types
-
(None.)