package ez_api
Easy API library and tools
Install
Dune Dependency
github.com
Readme
Changelog
LGPL-2.1-only WITH OCaml-LGPL-linking-exception License
Edit opam file
Versions (6)
Authors
Maintainers
Sources
1.2.0.tar.gz
md5=55bb40d00db6cd35cbf6ef6cff63363a
sha512=16922b231f19615ca7179a3c7d31e8c3897f2b37f574f69e06b35f12b501434c6eb85bec91cfed16ffd3eec71f8859d94bd003044a848560d434e04a0b1e99e2
doc/src/ez_api.server_utils/gMTime.ml.html
Source file gMTime.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
(* Times, in GMT, not in localtime () ! *) (* Computes the difference between GMT and localtime *) let diff = let time = Unix.gettimeofday () in let gmt,_ = Unix.mktime (Unix.gmtime time) in let local,_ = Unix.mktime (Unix.localtime time) in local -. gmt (* translate from localtime *) let of_local local = local -. diff (* translate to localtime *) let to_local gmt = gmt +. diff let time () = Unix.gettimeofday () let tm_of_date date = (* example: 2018-01-31T13:12:11Z *) let datelen = String.length date in assert (datelen >= 19); assert (date.[4] = '-'); assert (date.[7] = '-'); assert (date.[10] = 'T'); assert (date.[13] = ':'); assert (date.[16] = ':'); let tm_year = int_of_string (String.sub date 0 4) - 1900 in let tm_mon = int_of_string (String.sub date 5 2) - 1 in let tm_mday = int_of_string (String.sub date 8 2) in let tm_hour = int_of_string (String.sub date 11 2) in let tm_min = int_of_string (String.sub date 14 2) in let tm_sec = int_of_string (String.sub date 17 2) in Unix.({ tm_year; tm_mon; tm_mday; tm_hour; tm_min; tm_sec; (* recomputed *) tm_wday = 0; tm_yday = 0; tm_isdst = true; }) let date_of_tm tm = Printf.sprintf "%04d-%02d-%02dT%02d:%02d:%02dZ" (tm.Unix.tm_year+1900) (tm.Unix.tm_mon+1) tm.Unix.tm_mday tm.Unix.tm_hour tm.Unix.tm_min tm.Unix.tm_sec let time_of_tm tm = let time, _tm = Unix.mktime tm in time let tm_of_time time = Unix.localtime time let nsecs_per_day = 3600 * 24
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>