From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id D81CE7F0A3 for ; Sat, 5 Sep 2015 13:52:33 +0200 (CEST) IronPort-PHdr: 9a23:qN7wqBzln3W5Xm3XCy+O+j09IxM/srCxBDY+r6Qd0ewVIJqq85mqBkHD//Il1AaPBtWHraoUwLaM+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuStKU15T8i7r60qaQSjsLrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYeVcyDAgD1uSmxHh+pX4p8Y7oGwD884mosVJVKG/e6UjUfQMBz0jNyUx5db3nRjFVwqGoHUGBDY4iB1NVkLg5Qv5Q4zGjW3Nied8byyTO8u8BeQxUC6h8rwtVxLpkzwCPjg/2GDRzNBtieRXrUTy9FRE34fIbdTNZ7JFdaTHcIZCSA== Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=markus.weissmann@in.tum.de; spf=None smtp.mailfrom=markus.weissmann@in.tum.de; spf=None smtp.helo=postmaster@mail-out1.informatik.tu-muenchen.de Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of markus.weissmann@in.tum.de) identity=pra; client-ip=131.159.0.8; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="markus.weissmann@in.tum.de"; x-sender="markus.weissmann@in.tum.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of markus.weissmann@in.tum.de) identity=mailfrom; client-ip=131.159.0.8; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="markus.weissmann@in.tum.de"; x-sender="markus.weissmann@in.tum.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-out1.informatik.tu-muenchen.de) identity=helo; client-ip=131.159.0.8; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="markus.weissmann@in.tum.de"; x-sender="postmaster@mail-out1.informatik.tu-muenchen.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DmAAA71+pVnAgAn4Ndg3VpgyS6SwEJgW0MgkGCbIF4OBQBAQEBAQEBARABAQEBAQYNCQkhLoIdgjCBCwImAl8uiBMNpW6PY5Q6AQEBAR2BIodgiiwMLxIdgRQFlVUBhQmKAoZmkX2EKDwzAQEBiUcBAQE X-IPAS-Result: A0DmAAA71+pVnAgAn4Ndg3VpgyS6SwEJgW0MgkGCbIF4OBQBAQEBAQEBARABAQEBAQYNCQkhLoIdgjCBCwImAl8uiBMNpW6PY5Q6AQEBAR2BIodgiiwMLxIdgRQFlVUBhQmKAoZmkX2EKDwzAQEBiUcBAQE X-IronPort-AV: E=Sophos;i="5.17,474,1437429600"; d="scan'208";a="144833374" Received: from mail-out1.informatik.tu-muenchen.de ([131.159.0.8]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 05 Sep 2015 13:52:07 +0200 Received: (Authenticated sender: weissmam) by mail.in.tum.de (Postfix) with ESMTPSA id DC8401C244E for ; Sat, 5 Sep 2015 13:52:06 +0200 (CEST) From: =?utf-8?Q?=22Markus_W=2E_Wei=C3=9Fmann=22?= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-Id: <2CA44FB5-DDEF-48A6-8567-99DCE4A0BA66@in.tum.de> Date: Sat, 5 Sep 2015 13:52:04 +0200 To: caml-list Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) X-Mailer: Apple Mail (2.2104) Subject: [Caml-list] POSIX time implementation Hi, I was searching for an existing library implementing a clock_gettime(2) fun= ction that would deliver a =E2=80=98struct timespec=E2=80=99 [1] with the c= urrent time. I want it for my POSIX message queue implementation [2] for the timed funct= ions that require an absolute =E2=80=98struct timespec=E2=80=99 for their t= imeout. So what a user of mqueue requires is a 1.) function to get the current time= as =E2=80=98struct timespec=E2=80=99 and 2.) to add seconds/nanoseconds to= such a value to create a timeout. The existing solutions I found: * The Unix library [3] implements =E2=80=98struct timeval=E2=80=99 as float= (only microseconds, imho the float conversion is a bit of a hack =E2=80=94= a clever one though) * Netsys.clock_gettime from ocamlnet [4] implements =E2=80=99struct timespe= c=E2=80=99 but has it as float/int for seconds/nanoseconds (whats with the = float? All systems I found use either in32 or int64 for time_t) * Mtime [5] implements clock_gettime(2) but seems to only offers relative v= alues * Ptime [6] appears to be the uber-POSIX time implementation but lacks cloc= k_gettime (and probably always will) I=E2=80=99d like my library to be a good OCaml citizen and _not_ implement = my own special purpose timing functions (which are incompatible to everyone= else=E2=80=99s). Ptime looks like the ultimate solution for the datatype; ocamlnet gets the = closest to my requirements =E2=80=94 while being a gigantic library most of= which has nothing to do with the domain of mqueue. I=E2=80=99m a bit stuck on this one and would like to get some advice =E2= =80=94 and/or corrections if I misinterpreted one of the above solutions. regards -Markus [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html [2] http://mqueue.forge.ocamlcore.org/ [3] http://caml.inria.fr/pub/docs/manual-ocaml/libref/Unix.html [4] http://projects.camlcity.org/projects/dl/ocamlnet-4.0.4/doc/html-main/N= etsys_posix.html [5] http://erratique.ch/software/mtime [6] http://erratique.ch/software/ptime --=20 Markus Wei=C3=9Fmann, M.Sc. Technische Universit=C3=A4t M=C3=BCnchen Institut f=C3=BCr Informatik Boltzmannstr. 3 D-85748 Garching Germany http://wwwknoll.in.tum.de/