diff options
author | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2002-04-18 07:00:34 +0000 |
---|---|---|
committer | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 2002-04-18 07:00:34 +0000 |
commit | 3447e059f033e7d59b4262fe869115aae20bcb85 (patch) | |
tree | ec3442ebc0940aefd4d6ab0e67dd88c08d5f5496 /byterun/sys.c | |
parent | 059d9fc181595b6cf7d2d1a6472eb97fce1fe86a (diff) | |
download | ocaml-poly_meth2.tar.gz |
merging poly_meth2poly_meth2
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/poly_meth2@4692 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/sys.c')
-rw-r--r-- | byterun/sys.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/byterun/sys.c b/byterun/sys.c index f82fce4b3f..6ac6cdbce7 100644 --- a/byterun/sys.c +++ b/byterun/sys.c @@ -302,13 +302,18 @@ CAMLprim value sys_time(value unit) CAMLprim value sys_random_seed (value unit) { + long seed; #ifdef HAS_GETTIMEOFDAY struct timeval tv; gettimeofday(&tv, NULL); - return Val_int(tv.tv_sec ^ tv.tv_usec); + seed = tv.tv_sec ^ tv.tv_usec; #else - return Val_int(time (NULL)); + seed = time (NULL); #endif +#ifdef HAS_UNISTD + seed ^= getppid() << 16 | getpid(); +#endif + return Val_long(seed); } CAMLprim value sys_get_config(value unit) |