diff options
author | Eduardo Julian | 2021-07-29 19:23:23 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-07-29 19:23:23 -0400 |
commit | 54b28c1caeda08965c258411a32229be1766d47f (patch) | |
tree | ee0eecd3a009f80e716f2c3c07095bc80d3b70bb /stdlib/source/library/lux/time.lux | |
parent | 5d4583aebd00adced10275b32ff1a93ab418be50 (diff) |
Switched from the "from to" convention to the "minimum additional" convention.
Diffstat (limited to 'stdlib/source/library/lux/time.lux')
-rw-r--r-- | stdlib/source/library/lux/time.lux | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux index e726ad968..4a65fa4b8 100644 --- a/stdlib/source/library/lux/time.lux +++ b/stdlib/source/library/lux/time.lux @@ -148,7 +148,7 @@ (n.* utc_millis millis))))))) ) -(def: (pad value) +(def: (padded value) (-> Nat Text) (if (n.< 10 value) (text\compose "0" (n\encode value)) @@ -160,7 +160,7 @@ (duration.merge space duration) duration)) -(def: (encode_millis millis) +(def: (millis_format millis) (-> Nat Text) (cond (n.= 0 millis) "" (n.< 10 millis) ($_ text\compose ".00" (n\encode millis)) @@ -199,19 +199,19 @@ .nat ..of_millis)) -(def: (encode time) +(def: (format time) (-> Time Text) (let [(^slots [#hour #minute #second #milli_second]) (..clock time)] ($_ text\compose - (..pad hour) - ..separator (..pad minute) - ..separator (..pad second) - (..encode_millis milli_second)))) + (..padded hour) + ..separator (..padded minute) + ..separator (..padded second) + (..millis_format milli_second)))) (implementation: #export codec {#.doc (doc "Based on ISO 8601." "For example: 21:14:51.827")} (Codec Text Time) - (def: encode ..encode) + (def: encode ..format) (def: decode (<text>.run ..parser))) |