caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] date - waiting for 64-bit (was: Gripes with array)
@ 2004-09-09 11:55 Samuel Lelievre
  2004-09-09 12:21 ` Basile Starynkevitch [local]
  2004-09-09 16:12 ` [Caml-list] date - waiting for 64-bit (was: Gripes with array) james woodyatt
  0 siblings, 2 replies; 7+ messages in thread
From: Samuel Lelievre @ 2004-09-09 11:55 UTC (permalink / raw)
  To: Caml-list

Ville-Pertti Keinonen wrote:

>...and personally I hope we'll all be migrating to 64-bit
>architectures soon, anyhow.

In the meanwhile, is there a way to work around the following?

------------------------------------------------------------------
>        Caml Light version 0.75

##open "unix";;
#time ();;
- : int = -1052752875
#gmtime (time ());;
- : tm =
  {tm_sec = 51; tm_min = 38; tm_hour = 8; tm_mday = 22; tm_mon = 7;
   tm_year = 36; tm_wday = 6; tm_yday = 234; tm_isdst = false}
#
------------------------------------------------------------------

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] date - waiting for 64-bit (was: Gripes with array)
  2004-09-09 11:55 [Caml-list] date - waiting for 64-bit (was: Gripes with array) Samuel Lelievre
@ 2004-09-09 12:21 ` Basile Starynkevitch [local]
  2004-09-09 13:20   ` [Caml-list] date - waiting for 64-bit Samuel Lelievre
  2004-09-09 16:12 ` [Caml-list] date - waiting for 64-bit (was: Gripes with array) james woodyatt
  1 sibling, 1 reply; 7+ messages in thread
From: Basile Starynkevitch [local] @ 2004-09-09 12:21 UTC (permalink / raw)
  To: caml-list

On Thu, Sep 09, 2004 at 01:55:47PM +0200, Samuel Lelievre wrote:
> Ville-Pertti Keinonen wrote:
> 
> >...and personally I hope we'll all be migrating to 64-bit
> >architectures soon, anyhow.
> 
> In the meanwhile, is there a way to work around the following?
> 
> ------------------------------------------------------------------
> >       Caml Light version 0.75
> 
> ##open "unix";;
> #time ();;
> - : int = -1052752875
> #gmtime (time ());;
> - : tm =
>  {tm_sec = 51; tm_min = 38; tm_hour = 8; tm_mday = 22; tm_mon = 7;
>   tm_year = 36; tm_wday = 6; tm_yday = 234; tm_isdst = false}
> #

I suggest to switch to Ocaml (even on a 32 bits machine)

% ocaml
        Objective Caml version 3.08.0

# #load "unix.cma";;
# Unix.time ();;
- : float = 1094732223.
# Unix.gmtime (Unix.time ());;
- : Unix.tm =
{Unix.tm_sec = 16; Unix.tm_min = 17; Unix.tm_hour = 12; Unix.tm_mday = 9;
 Unix.tm_mon = 8; Unix.tm_year = 104; Unix.tm_wday = 4; Unix.tm_yday = 252;
 Unix.tm_isdst = false}
# 

I am not sure that staying in Caml Light is a sensible thing to do,
especially for code that you are working on. Maybe taking the
necessary time to port your code from Caml-Light (which is not active
anymore) to Ocaml (which is actively developped and has a bigger
community) is really worth the effort.


-- 
Basile STARYNKEVITCH -- basile dot starynkevitch at inria dot fr
Project cristal.inria.fr - temporarily
http://cristal.inria.fr/~starynke --- all opinions are only mine 

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] date - waiting for 64-bit
  2004-09-09 12:21 ` Basile Starynkevitch [local]
@ 2004-09-09 13:20   ` Samuel Lelievre
  2004-09-09 13:44     ` Basile Starynkevitch [local]
  2004-09-09 13:49     ` Marcin 'Qrczak' Kowalczyk
  0 siblings, 2 replies; 7+ messages in thread
From: Samuel Lelievre @ 2004-09-09 13:20 UTC (permalink / raw)
  To: Caml-list

Basile Starynkevitch wrote:
>I suggest to switch to Ocaml (even on a 32 bits machine)
>
>% ocaml
>         Objective Caml version 3.08.0
>
># #load "unix.cma";;
># Unix.time ();;
>- : float = 1094732223.
># Unix.gmtime (Unix.time ());;
>- : Unix.tm =
>{Unix.tm_sec = 16; Unix.tm_min = 17; Unix.tm_hour = 12; Unix.tm_mday = 9;
>  Unix.tm_mon = 8; Unix.tm_year = 104; Unix.tm_wday = 4; Unix.tm_yday = 252;
>  Unix.tm_isdst = false}
>#
>
>I am not sure that staying in Caml Light is a sensible thing to do,
>especially for code that you are working on. Maybe taking the
>necessary time to port your code from Caml-Light (which is not active
>anymore) to Ocaml (which is actively developped and has a bigger
>community) is really worth the effort.

Do you mean that the integers of type int are not mod 2^31 in Ocaml?

That's certainly an argument to make me make my mind to switch,
which I was postponing forever, having failed to translate my
simple programs to Ocaml (I have to confess I did not try hard).

I learnt how to use the "num" library in order to deal with larger
integers than 2^30, but if Ocaml makes it simpler...

I was sticking to the advice on
http://caml.inria.fr/ocaml/bigpicture.html

   Should I switch from Caml Light to Objective Caml?

   Caml Light is still maintained, though no longer actively
   developed.  We make bug-fix releases from time to time and
   still provide support for it.  It provides a more stable
   programming environment than Objective Caml, which is still
   evolving, though at a slower pace than immediately after its
   introduction.

   If you're perfectly happy with Caml Light, value reliability
   more than performance, don't need the new module system, don't
   need the new object stuff, then stay with Caml Light. If you
   need objects, powerful modules, the native-code compiler, or
   just like being on the cutting edge, go for Objective Caml.


Samuel Lelievre

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] date - waiting for 64-bit
  2004-09-09 13:20   ` [Caml-list] date - waiting for 64-bit Samuel Lelievre
@ 2004-09-09 13:44     ` Basile Starynkevitch [local]
  2004-09-09 14:03       ` Marcin 'Qrczak' Kowalczyk
  2004-09-09 13:49     ` Marcin 'Qrczak' Kowalczyk
  1 sibling, 1 reply; 7+ messages in thread
From: Basile Starynkevitch [local] @ 2004-09-09 13:44 UTC (permalink / raw)
  To: caml-list

On Thu, Sep 09, 2004 at 03:20:38PM +0200, Samuel Lelievre wrote:
> Basile Starynkevitch wrote:
> >I suggest to switch to Ocaml (even on a 32 bits machine) ...
> 
> Do you mean that the integers of type int are not mod 2^31 in Ocaml?

You have four integer types in Ocaml: int (on 31 bits), Int32.t (on 32
bits) and Int64.t (on 64 bits) and NativeInt.t (32 bits on 32 bits
machine, 64 bits on 64 bits machines). The details and tradeoffs are
documented.

But the current date & time, as returned by Unix.time, is a *floating
point* number, and Unix.gmtime take a floating point number as an
arguments (so there won't be any Y2K or 2038 problem because of
Ocaml's fault in the foreseeable future, long after we are all back to
dust - not even bare bones). Floating point are enough for time
representation on both 32 and 64 bits machine.

> That's certainly an argument to make me make my mind to switch,
> which I was postponing forever, having failed to translate my
> simple programs to Ocaml (I have to confess I did not try hard).

I am suggesting to try harder. Using Ocaml is IMHO much better than
using CamlLight. OReilly has a very good french book on Ocaml
programming.


-- 
Basile STARYNKEVITCH -- basile dot starynkevitch at inria dot fr
Project cristal.inria.fr - temporarily.

http://cristal.inria.fr/~starynke --- all opinions are only mine 

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] date - waiting for 64-bit
  2004-09-09 13:20   ` [Caml-list] date - waiting for 64-bit Samuel Lelievre
  2004-09-09 13:44     ` Basile Starynkevitch [local]
@ 2004-09-09 13:49     ` Marcin 'Qrczak' Kowalczyk
  1 sibling, 0 replies; 7+ messages in thread
From: Marcin 'Qrczak' Kowalczyk @ 2004-09-09 13:49 UTC (permalink / raw)
  To: Samuel Lelievre; +Cc: Caml-list

Samuel Lelievre <samuel.lelievre@free.fr> writes:

>># Unix.time ();;
>>- : float = 1094732223.

> Do you mean that the integers of type int are not mod 2^31 in Ocaml?

They are. But Unix.time() is a float.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak@knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] date - waiting for 64-bit
  2004-09-09 13:44     ` Basile Starynkevitch [local]
@ 2004-09-09 14:03       ` Marcin 'Qrczak' Kowalczyk
  0 siblings, 0 replies; 7+ messages in thread
From: Marcin 'Qrczak' Kowalczyk @ 2004-09-09 14:03 UTC (permalink / raw)
  To: Basile Starynkevitch [local]; +Cc: caml-list

"Basile Starynkevitch [local]" <basile.starynkevitch@inria.fr> writes:

> You have four integer types in Ocaml: int (on 31 bits), Int32.t (on 32
> bits) and Int64.t (on 64 bits) and NativeInt.t (32 bits on 32 bits
> machine, 64 bits on 64 bits machines). The details and tradeoffs are
> documented.

int has 63 bits on 64-bit machines.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak@knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] date - waiting for 64-bit (was: Gripes with array)
  2004-09-09 11:55 [Caml-list] date - waiting for 64-bit (was: Gripes with array) Samuel Lelievre
  2004-09-09 12:21 ` Basile Starynkevitch [local]
@ 2004-09-09 16:12 ` james woodyatt
  1 sibling, 0 replies; 7+ messages in thread
From: james woodyatt @ 2004-09-09 16:12 UTC (permalink / raw)
  To: Caml List

On 09 Sep 2004, at 04:55, Samuel Lelievre wrote:
>
> In the meanwhile, is there a way to work around the following?
>
> ------------------------------------------------------------------
>>        Caml Light version 0.75
>
> ##open "unix";;
> #time ();;
> - : int = -1052752875
> #gmtime (time ());;
> - : tm =
>  {tm_sec = 51; tm_min = 38; tm_hour = 8; tm_mday = 22; tm_mon = 7;
>   tm_year = 36; tm_wday = 6; tm_yday = 234; tm_isdst = false}
> #
> ------------------------------------------------------------------

Shameless promotion: after you migrate away from Caml Light to OCaml 
3.08.1, you may want to have a look at the Cf library in OCaml NAE 
project on SF.Net <URL:http://www.sf.net/projects/ocnae/>, where you 
will find an implementation of Daniel Bernstein's TAI64 time 
representation.

If you are serious about working with values of standard time, then the 
Unix time functions are not your friends.  They have lots of twisty 
little constraints on the utility of the values they give and take that 
are not at all intuitive.


-- 
j h woodyatt <jhw@wetware.com>
markets are only free to the people who own them.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-09-09 16:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-09 11:55 [Caml-list] date - waiting for 64-bit (was: Gripes with array) Samuel Lelievre
2004-09-09 12:21 ` Basile Starynkevitch [local]
2004-09-09 13:20   ` [Caml-list] date - waiting for 64-bit Samuel Lelievre
2004-09-09 13:44     ` Basile Starynkevitch [local]
2004-09-09 14:03       ` Marcin 'Qrczak' Kowalczyk
2004-09-09 13:49     ` Marcin 'Qrczak' Kowalczyk
2004-09-09 16:12 ` [Caml-list] date - waiting for 64-bit (was: Gripes with array) james woodyatt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).