This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,4 @@
(test
(name portable)
(package mirage-ptime)
(libraries mirage-ptime))

View file

@ -0,0 +1,20 @@
let print_time () =
let now = Mirage_ptime.now () in
Format.printf "The time is %a.\n" (Ptime.pp_rfc3339 ()) now
let print_offset c =
match Mirage_ptime.current_tz_offset_s c with
| Some offset -> Printf.printf "The offset from UTC is %d minutes.\n" offset
| None -> Printf.printf "Clock UTC offset unavailable\n"
let print_period c =
match Mirage_ptime.period c with
| Some span -> Format.printf "The clock period is: %a\n" Ptime.Span.pp span
| None -> Printf.printf "Clock period unavailable\n"
let () =
print_time ();
print_time ();
print_time ();
print_offset ();
print_period ()