[fpc-devel] NowUTC in the RTL

Marco van de Voort marcov at stack.nl
Fri Dec 9 16:04:28 CET 2011

In our previous episode, Michael Van Canneyt said:
> >>> clock_gettime is a linux kernel call. No-one is proposing to add it to sysutils.
> >>
> >> If we decide to use it via libc, we might not have to add it as a syscall.
> That sounds as if you think a syscall is a bad thing ? 

For borderline functionality ? yes I do.

It is something else to avoid the core system getting to entangled with
libc, but that doesn't mean I want to reimplement all libc of all unixy
platforms and maintain that.

If it is not necessary, IMHO we shouldn't add it to core units. Including

> > Let's not forget btw that it is not just a matter of the call, the constants
> > matter too.
> This is not a real argument; 
> The constants or types for many other posixy-functions are system dependent; 
> we introduced them anyway.

The problem is that you don't want clock_gettime(), 
but clock_gettime(MONOTONIC_RAW).

The constant is not something where you merely have to search the relevant
values for the various OS, and have one or two that are unsupported, but
the core reason to add it is not portable. At least if I understood
everything correctly.

There is a fat chance that the whole finely grained monotonic stuff is
highly OS specific.  But maybe Helmut can weigh in on that again.

> Well, if OS-X does not have it, we can't really say it is POSIX for our purposes, 
> so then it goes to the linux unit. It's as simple as that.
> Unless you have arguments for putting it in (base)unix anyway.

No. Better put it in target specific units, so that people know they are
messing with functions with portability issues.

More information about the fpc-devel mailing list