This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
4
unikernel/duniverse/mirage-ptime/lib_test/dune
Normal file
4
unikernel/duniverse/mirage-ptime/lib_test/dune
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(test
|
||||
(name portable)
|
||||
(package mirage-ptime)
|
||||
(libraries mirage-ptime))
|
||||
20
unikernel/duniverse/mirage-ptime/lib_test/portable.ml
Normal file
20
unikernel/duniverse/mirage-ptime/lib_test/portable.ml
Normal 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 ()
|
||||
Loading…
Add table
Add a link
Reference in a new issue