Page
Library
Module
Module type
Parameter
Class
Class type
Source
OCaml time handling and reasoning library
Note: The project core is largely complete, but still undergoing testing - you're welcome to use it in prototypes, but avoid using it in production for now. The NLP component is WIP.
Disclaimer: Timere is not designed to handle prehistoric events. For prehistoric planning and booking software, please consult appropriate experts.
Christmases which fall on Wednesday from now
let () =
let open Timere in
match
resolve (
after (Date_time.now ())
& months [`Dec]
& days [25]
& weekdays [`Wed]
)
with
| Error msg -> failwith msg
| Ok s ->
Fmt.pr "%a@." (pp_intervals ~sep:(Fmt.any "@.") ()) s
gives
[2024 Dec 25 00:00:00 +00:00:00, 2024 Dec 26 00:00:00 +00:00:00)
[2030 Dec 25 00:00:00 +00:00:00, 2030 Dec 26 00:00:00 +00:00:00)
[2041 Dec 25 00:00:00 +00:00:00, 2041 Dec 26 00:00:00 +00:00:00)
[2047 Dec 25 00:00:00 +00:00:00, 2047 Dec 26 00:00:00 +00:00:00)
[2052 Dec 25 00:00:00 +00:00:00, 2052 Dec 26 00:00:00 +00:00:00)
[2058 Dec 25 00:00:00 +00:00:00, 2058 Dec 26 00:00:00 +00:00:00)
...
See examples/
for more examples
Timestamp and date time handling with platform independent time zone support
Reasoning over time intervals via timere
objects/expressions, examples:
Include timere
in the libraries
stanza in your dune file, and optionally one of the following two to select a concrete implementation of time zone data source
timere.tzdb.full
timere.tzdb.none
The following resources should allow you to implement said approach readily
tzdb-json/
.gen-artifacts/available-time-zones.txt
Time_zone.of_json_string
can load files in tzdb-json/
Note: While tzdb-json/
may be useful and usable outside of Timere, we make no guarantees that the JSON format stays unmodified (though changes of the format should be a rare occurrence, if ever occurring)
Code files are licensed under the MIT license as specified in the LICENSE
file
Time zone database derived files are licensed under its original terms (public domain)
zdump
command output into src/time_zone_data.ml
, using the IANA database (as time zone files) distributed on LinuxTime zone data handling code copies approach used by chrono-tz