diff options
Diffstat (limited to '')
| -rw-r--r-- | stdlib/source/library/lux/time/instant.lux | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/stdlib/source/library/lux/time/instant.lux b/stdlib/source/library/lux/time/instant.lux index c89ffbd09..858a29632 100644 --- a/stdlib/source/library/lux/time/instant.lux +++ b/stdlib/source/library/lux/time/instant.lux @@ -32,49 +32,49 @@ ["." day (#+ Day)] ["." date (#+ Date)]]) -(abstract: #export Instant - Int - +(abstract: .public Instant {#.doc "Instant is defined as milli-seconds since the epoch."} - (def: #export of_millis + Int + + (def: .public of_millis (-> Int Instant) (|>> :abstraction)) - (def: #export millis + (def: .public millis (-> Instant Int) (|>> :representation)) - (def: #export (span from to) + (def: .public (span from to) (-> Instant Instant Duration) (duration.of_millis (i.- (:representation from) (:representation to)))) - (def: #export (after duration instant) + (def: .public (after duration instant) (-> Duration Instant Instant) (:abstraction (i.+ (duration.millis duration) (:representation instant)))) - (def: #export (relative instant) + (def: .public (relative instant) (-> Instant Duration) (|> instant :representation duration.of_millis)) - (def: #export (absolute offset) + (def: .public (absolute offset) (-> Duration Instant) (|> offset duration.millis :abstraction)) - (implementation: #export equivalence + (implementation: .public equivalence (Equivalence Instant) (def: (= param subject) (\ i.equivalence = (:representation param) (:representation subject)))) - (implementation: #export order + (implementation: .public order (Order Instant) (def: &equivalence ..equivalence) (def: (< param subject) (\ i.order < (:representation param) (:representation subject)))) - (`` (implementation: #export enum + (`` (implementation: .public enum (Enum Instant) (def: &order ..order) @@ -86,7 +86,7 @@ )))) ) -(def: #export epoch +(def: .public epoch {#.doc "The instant corresponding to 1970-01-01T00:00:00Z."} Instant (..of_millis +0)) @@ -147,7 +147,7 @@ (duration.merged (duration.up time duration.milli_second)) ..absolute)))) -(implementation: #export codec +(implementation: .public codec {#.doc (doc "Based on ISO 8601." "For example: 2017-01-15T21:14:51.827Z")} (Codec Text Instant) @@ -155,7 +155,7 @@ (def: encode ..format) (def: decode (<text>.run ..parser))) -(def: #export now +(def: .public now {#.doc (doc "Yields the current instant, as measured from the operating-system's clock.")} (IO Instant) (io (..of_millis (for {@.old ("jvm invokestatic:java.lang.System:currentTimeMillis:") @@ -198,7 +198,7 @@ })))) (template [<field> <type> <post_processing>] - [(def: #export (<field> instant) + [(def: .public (<field> instant) (-> Instant <type>) (let [[date time] (..date_time instant)] (|> <field> <post_processing>)))] @@ -207,7 +207,7 @@ [time Time ..clock_time] ) -(def: #export (day_of_week instant) +(def: .public (day_of_week instant) (-> Instant Day) (let [offset (..relative instant) days (duration.query duration.day offset) @@ -231,7 +231,7 @@ +6 #day.Saturday _ (undefined)))) -(def: #export (of_date_time date time) +(def: .public (of_date_time date time) (-> Date Time Instant) (|> (date.days date) (i.* (duration.millis duration.day)) |
