diff --git a/Makefile b/Makefile index 7dbd270..e00f42f 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ MODS = tjutil tjutf16 tjllist tjparserMonad tjjson \ xmlm \ cpdfwriteJSON cpdfstrftime cpdfcoord cpdf cpdfcommand -SOURCES = $(foreach x,$(MODS),$(x).ml $(x).mli) cpdfcommandrun.ml +SOURCES = gettimeofday.c $(foreach x,$(MODS),$(x).ml $(x).mli) cpdfcommandrun.ml RESULT = cpdf ANNOTATE = true diff --git a/gettimeofday.c b/gettimeofday.c new file mode 100644 index 0000000..7ce86f8 --- /dev/null +++ b/gettimeofday.c @@ -0,0 +1,27 @@ +/**************************************************************************/ +/* */ +/* OCaml */ +/* */ +/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ +/* */ +/* Copyright 1996 Institut National de Recherche en Informatique et */ +/* en Automatique. */ +/* */ +/* All rights reserved. This file is distributed under the terms of */ +/* the GNU Lesser General Public License version 2.1, with the */ +/* special exception on linking described in the file LICENSE. */ +/* */ +/**************************************************************************/ + +#include +#include +#include +#include +#include + +CAMLprim value unix_gettimeofday(value unit) +{ + struct timeval tp; + gettimeofday(&tp, NULL); + return caml_copy_double((double) tp.tv_sec + (double) tp.tv_usec / 1e6); +}