caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gerd Stolpmann <info@gerd-stolpmann.de>
To: "\"Markus W. Weißmann\"" <markus.weissmann@in.tum.de>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] POSIX time implementation
Date: Sat, 05 Sep 2015 18:59:37 +0200	[thread overview]
Message-ID: <1441472377.5306.45.camel@e130.lan.sumadev.de> (raw)
In-Reply-To: <2CA44FB5-DDEF-48A6-8567-99DCE4A0BA66@in.tum.de>

[-- Attachment #1: Type: text/plain, Size: 2338 bytes --]

Am Samstag, den 05.09.2015, 13:52 +0200 schrieb "Markus W. Weißmann":
> Hi,
> 
> * Netsys.clock_gettime from ocamlnet [4] implements ’struct timespec’ 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)

I picked float for ease of use, and better compatibility with the time
functions in Unix (which all use floats for time_t). Only the integral
part is put into the float which provides 52 bits for the mantissa, so
it is really large enough.

> I’d like my library to be a good OCaml citizen and _not_ implement my own special purpose timing functions (which are incompatible to everyone else’s).
> Ptime looks like the ultimate solution for the datatype; ocamlnet gets the closest to my requirements — while being a gigantic library most of which has nothing to do with the domain of mqueue.

You'd only need the netsys part, which is practically standalone. None
of the other modules would get linked in. (I guess your are programming
for embedded platforms as POSIX message queues are typically found
there, and the size of executable probably matters.)

Of course you could also just copy the C code. OCamlnet has a liberal
license.

Gerd

> I’m a bit stuck on this one and would like to get some advice — 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/Netsys_posix.html
> [5] http://erratique.ch/software/mtime
> [6] http://erratique.ch/software/ptime
> 
> -- 
> Markus Weißmann, M.Sc.
> Technische Universität München
> Institut für Informatik
> Boltzmannstr. 3
> D-85748 Garching
> Germany
> http://wwwknoll.in.tum.de/
> 
> 

-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    gerd@gerd-stolpmann.de
My OCaml site:          http://www.camlcity.org
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
------------------------------------------------------------


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2015-09-05 16:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-05 11:52 "Markus W. Weißmann"
2015-09-05 16:59 ` Gerd Stolpmann [this message]
2015-09-06  0:04 ` Milan Stanojević
2015-09-08  9:02 ` Markus Weißmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441472377.5306.45.camel@e130.lan.sumadev.de \
    --to=info@gerd-stolpmann.de \
    --cc=caml-list@inria.fr \
    --cc=markus.weissmann@in.tum.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).