[Caml-list] Ocaml can't convert a GMT time into a float!

2010-03-06 Thread Luca de Alfaro
I need to convert a time, expressed in /mm/dd hh:mm:ss form, into a floating point. The conversion has to be done in GMT, but the real point is, the conversion must NOT change due to daylight savings time. Ocaml seems to have only one conversion function, however: Unix.mktime, which takes a ti

Re: [Caml-list] Ocaml can't convert a GMT time into a float!

2010-03-06 Thread blue storm
If you want a fine-grained timezones and daylight saving times handling, you may use a dedicated library for date and time, such that Calendar (wich is used by PG'OCaml to represent SQL date/time values) : http://calendar.forge.ocamlcore.org/ ___ Caml-lis

Re: [Caml-list] Ocaml can't convert a GMT time into a float!

2010-03-06 Thread Erik de Castro Lopo
blue storm wrote: > If you want a fine-grained timezones and daylight saving times handling, you > may use a dedicated library for date and time, such that Calendar (wich is > used by PG'OCaml to represent SQL date/time values) : > http://calendar.forge.ocamlcore.org/ I really like the way the Ne

Re: [Caml-list] Ocaml can't convert a GMT time into a float!

2010-03-06 Thread Yaron Minsky
The TZ module in Core could also be helpful here. y On Sat, Mar 6, 2010 at 4:53 AM, Luca de Alfaro wrote: > I need to convert a time, expressed in /mm/dd hh:mm:ss form, into a > floating point. > The conversion has to be done in GMT, but the real point is, the conversion > must NOT change d

Re: [Caml-list] Ocaml can't convert a GMT time into a float!

2010-03-06 Thread Dave Benjamin
Luca de Alfaro wrote: I need to convert a time, expressed in /mm/dd hh:mm:ss form, into a floating point. The conversion has to be done in GMT, but the real point is, the conversion must NOT change due to daylight savings time. Ocaml seems to have only one conversion function, however: Uni

Re: [Caml-list] Ocaml can't convert a GMT time into a float!

2010-03-07 Thread Luca de Alfaro
Thanks to all! I see, I am glad there are good alternative libraries! For my problem, I preferred to avoid having dependence on one more library for only 10 lines of code, so I wrote some code to do the conversion. It works only for dates after 1970, and it is somewhat inelegant; it is here: http

Re: [Caml-list] Ocaml can't convert a GMT time into a float!

2010-03-07 Thread Luca de Alfaro
Sorry: wrong link. The code is here: http://luca.dealfaro.org/converting-gmt-time-into-unix-time-in-ocaml On Sun, Mar 7, 2010 at 10:05 AM, Luca de Alfaro wrote: > Thanks to all! > > I see, I am glad there are good alternative libraries! > For my problem, I preferred to avoid having dependence o