Library
Module
Module type
Parameter
Class
Class type
exception Error_exn of error
val make :
?ns:int ->
?s_frac:float ->
hour:int ->
minute:int ->
second:int ->
unit ->
(t, error) Stdlib.result
Constructs t
from specification of the time of day.
Leap second can be specified by providing 60 for second
. Note that leap second informtation is lost upon translation to timestamp(s), specifically second 60 is treated as second 59.
24:00:00
is treated as 23:59:59.999_999_999
.
Nanosecond used is the addition of ns
and s_frac * 10^9
.
Returns Error `Invalid_hour
if hour < 0 || 24 < hour
.
Returns Error `Invalid_hour
if hour = 24
and minute <> 0 || second <> 0 || total ns <> 0
.
Returns Error `Invalid_minute
if minute < 0 || 59 < minute
.
Returns Error `Invalid_second
if second < 0 || 60 < second
.
Returns Error `Invalid_ns
if s_frac < 0.0
.
Returns Error `Invalid_ns
if ns < 0
.
Returns Error `Invalid_ns
if total ns >= 10^9
.
val make_exn :
?ns:int ->
?s_frac:float ->
hour:int ->
minute:int ->
second:int ->
unit ->
t
val hour : t -> int
val minute : t -> int
val second : t -> int
val ns : t -> int
val is_leap_second : t -> bool