[D-runtime] Why is clock_gettime() commented out?
Jonathan M Davis
jmdavisProg at gmx.com
Thu Nov 18 21:38:30 PST 2010
On Thursday 18 November 2010 21:24:16 Sean Kelly wrote:
> On Nov 18, 2010, at 6:57 PM, Jonathan M Davis wrote:
> > Is there a particular reason why clock_gettime() and various related
> > posix C time functions are all commented out in core.sys.posix.time and
> > core.sys.posix.signals? They're necessary to get either a realtime clock
> > or a monotonic clock on Posix systems. It is true that that necessetates
> > linking with -lrt, but as far as I know, all Posix systems should have
> > librt, and the flag could be added to dmd.conf.
> >
> > The stopwatch code in std.datetime is going to be potentially inaccurate
> > without clock_gettime(), and the normal time code won't be quite as
> > precise. Ideally, clock_gettime() would be available. Why are all of
> > those time functions commented out? Were they causing problems somehow?
>
> I don't recall. I wrote all of the linux header blocks while the others
> were submitted. My best guess is that they weren't defined back when I
> created the headers. I see no problem with uncommenting them so long as
> the functions exist though. I'll verify and then make the change for
> linux and OSX.
They definitely should exist. The caveat is that you have to link with librt for
them to work (why they didn't just stick them in glibc proper, I have no idea -
especially when anything that cares about precision time at all should be using
them).
- Jonathan M Davis
More information about the D-runtime
mailing list