summaryrefslogtreecommitdiff
path: root/byterun/sys.c
diff options
context:
space:
mode:
authorJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2002-04-18 07:00:34 +0000
committerJacques Garrigue <garrigue at math.nagoya-u.ac.jp>2002-04-18 07:00:34 +0000
commit3447e059f033e7d59b4262fe869115aae20bcb85 (patch)
treeec3442ebc0940aefd4d6ab0e67dd88c08d5f5496 /byterun/sys.c
parent059d9fc181595b6cf7d2d1a6472eb97fce1fe86a (diff)
downloadocaml-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.c9
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)