Represents a time relative to an unspecified date and in an unspecified
time zone.
The date.Time class privately implements
Comparable, so date.Time instances
can be compared with operators like < and >.
A date.Time instance is serializable.
> def tm = date.Time(~hour: 5, ~minute: 45) |
|
|
Time(~hour: 5, ~minute: 45, ~second: 0, ~nanosecond: 0) |
|
"05:45:00" |
> tm < date.Time(~hour: 6, ~minute: 10) |
|
#true |
Uses the system clock via
system.milliseconds to get the
current time and using the operating system’s facilities to get a time
of day relative to either the current time zone (when
local is
true) or UTC (when
local is false).
Uses operating system facilities to convert a number of seconds since
the epoch to a time of day relative to either the current time
zone (when
local is true) or UTC (when
local is
false).
If the operating system reports a time within a leap second, then the
reported time is the end of the preceding second.
|
Time(~hour: 0, ~minute: 0, ~second: 0, ~nanosecond: 0) |
Converts
tm to a string format depending on
time_format. See
date.TimeFormat
for more information.
> def tm1 = date.Time(~hour: 5, ~minute: 45, ~second: 1, ~nanosecond: 70000) |
|
|
"05:45:01" |
|
"05:45:01.000070000" |
|
"05:45:01.000070" |