(.using [library [lux (.full) ["[0]" time] [abstract [monad (.only do)]] [control ["<>" parser ["<[0]>" text (.only Parser)]]] [data [text ["%" format]]] [math [number ["n" nat]]]]] ["[0]" // "_" ["[1]" date]]) (type: .public Time time.Time) (def: .public (format value) (%.Format Time) (let [(open "_[0]") (time.clock value)] (%.format (//.pad _#hour) (//.pad _#minute) (//.pad _#second)))) (def: .public parser (.Parser Time) (do <>.monad [hour (<>.codec n.decimal (.exactly 2 .decimal)) minute (<>.codec n.decimal (.exactly 2 .decimal)) second (<>.codec n.decimal (.exactly 2 .decimal))] (<>.lifted (time.time [time.#hour hour time.#minute minute time.#second second time.#milli_second 0]))))