[D-runtime] Why is clock_gettime() commented out?

Sean Kelly sean at invisibleduck.org
Thu Nov 18 21:24:16 PST 2010


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.


More information about the D-runtime mailing list