From 06ae841c0994f2e49f9cd837bed9db70b14befeb Mon Sep 17 00:00:00 2001 From: John Whitington Date: Tue, 7 Jun 2022 16:51:03 +0100 Subject: [PATCH] more --- cpdfstrftime.ml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/cpdfstrftime.ml b/cpdfstrftime.ml index 892bd17..ad1d918 100644 --- a/cpdfstrftime.ml +++ b/cpdfstrftime.ml @@ -125,8 +125,26 @@ let year_day d m y = let n3 = 1 + (y - 4 * (y / 4) + 2) / 3 in n1 - n2 * n3 + d - 30 +(* OCAML *) +let js_date () = dummy + +(* JS *) +(* +let js_date () = + let d = Unix.localtime (Unix.time ()) in + {_tm_sec = d.tm_sec; + _tm_min = d.tm_min; + _tm_hour = d.tm_hour; + _tm_mday = d.tm_mday; + _tm_mon = d.tm_mon; + _tm_year = d.tm_year; + _tm_wday = d.tm_wday; + _tm_yday = d.tm_yday; + _tm_isdst = d.tm_isdst} +*) + let return_date () = - match Sys.backend_type with Sys.Other "js_of_ocaml" -> dummy | _ -> + match Sys.backend_type with Sys.Other "js_of_ocaml" -> js_date () | _ -> match Sys.os_type with "Unix" -> (* Call the POSIX 'date' program, redirected to a temp file, and parse. *)