123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159typet=int64letof_us_64m=ifm<0Ltheninvalid_arg"negative";ifInt64.comparem0x4189374BC6A7EDL=1theninvalid_arg"out of range";Int64.mul1_000Lmletof_usm=of_us_64(Int64.of_intm)letof_ms_64m=ifm<0Ltheninvalid_arg"negative";ifInt64.comparem0x10C6F7A0B5EDL=1theninvalid_arg"out of range";Int64.mul1_000_000Lmletof_msm=of_ms_64(Int64.of_intm)letof_sec_64s=ifs<0Ltheninvalid_arg"negative";ifInt64.compares0x44B82FA09L=1theninvalid_arg"out of range";Int64.mul1_000_000_000Lsletof_secm=of_sec_64(Int64.of_intm)letof_minm=ifm<0theninvalid_arg"negative";letm=Int64.of_intminifInt64.comparem0x12533FE6L=1theninvalid_arg"out of range";Int64.mul60_000_000_000Lmlethour=3600_000_000_000Lletof_hourh=ifh<0theninvalid_arg"negative";leth=Int64.of_inthinifInt64.compareh0x4E2FFFL=1theninvalid_arg"out of range";Int64.mulhourhletday=Int64.mul24Lhourletof_dayd=ifd<0theninvalid_arg"negative";letd=Int64.of_intdinifInt64.compared0x341FFL=1theninvalid_arg"out of range";Int64.muldaydletyear=Int64.mul8766Lhourletof_yeary=ify<0theninvalid_arg"negative";lety=Int64.of_intyinifInt64.comparey0x248L=1theninvalid_arg"out of range";Int64.mulyearyletof_ff=iff<0.theninvalid_arg"negative";iff>18446744073.709549theninvalid_arg"out of range";lets=Int64.of_floatfinletrem=f-.(Int64.to_floats)inletns=Int64.of_float(rem*.1_000_000_000.)inInt64.(add(mul1_000_000_000Ls)ns)letto_ft=letpl=ift>=0Lthen0.elseabs_float(2.*.(Int64.to_float0x8000000000000000L))inletns=Int64.to_floattin(ns+.pl)/.1_000_000_000.letto_int64td=letfc=Int64.divcdinift<0LthenInt64.(add(f(Int64.addtInt64.min_int))(add(fInt64.max_int)1L))elseftletto_inttd=letr=to_int64tdinifr>Int64.of_intmax_inttheninvalid_arg"value too big for this platform";Int64.to_intrletto_us_64t=to_int64t1_000Lletto_ust=to_intt1_000Lletto_ms_64t=to_int64t1_000_000Lletto_mst=to_intt1_000_000Lletto_sec_64t=to_int64t1_000_000_000Lletto_sect=to_intt1_000_000_000Lletto_mint=to_intt60_000_000_000Lletto_hourt=to_intthourletto_dayt=to_inttdayletto_yeart=to_inttyearletfieldst=letsec=to_sec_64tinletleft=Int64.subt(of_sec_64sec)inletms=to_ms_64leftinletleft=Int64.subleft(of_ms_64ms)inletus=to_us_64leftinletns=Int64.(subleft(of_us_64us))in(sec,ms,us,ns)letppppft=letmin=to_mintinifmin>0thenlety=to_yeartinletleft=Int64.remtyearinletd=to_dayleftinletleft=Int64.remleftdayinify>0thenFormat.fprintfppf"%da%dd"ydelseleth=to_hourleftinletleft=Int64.remlefthourinifd>0thenFormat.fprintfppf"%dd%02dh"dhelseletmin=to_minleftinletleft=Int64.subt(of_minmin)inletsec=to_secleftinifh>0thenFormat.fprintfppf"%dh%02dm"hminelse(* if m > 0 then *)Format.fprintfppf"%dm%02ds"minsecelse(* below one minute *)lets,ms,us,ns=fieldstinifs>0LthenFormat.fprintfppf"%Ld.%03Lds"smselseifms>0LthenFormat.fprintfppf"%Ld.%03Ldms"msuselse(* if us > 0 then *)Format.fprintfppf"%Ld.%03Ldμs"usns