date and time, core access

Jonathan M Davis jmdavisProg at gmx.com
Sat Sep 25 22:07:27 PDT 2010


On Saturday 25 September 2010 21:37:30 Joel Christensen wrote:
> Thanks for the replies Jonathan M Davis and Yao G. :-)
> 
> Good to hear it's being worked on. I've other programs that are done
> with D1.0 that are all right.
> 
> I'm using Windows, would like it to work on Linux too though.
> 
> I think I'll use year month etc. separately instead of just having a big
> number (for converting to the time measurements).
> 
> How do you access the core library? I wanted to look at the core time
> module and couldn't, (C/C++ sites of course have that information any way).

If you want to use it, just import it. e.g. import core.sys.posix.time; I don't 
see a corresponding set of definitons for Windows though, for some reason - I 
have no idea why.

If you want to look at the code, then look look in your dmd directory. It's in 
src/druntime/src/. core.sys.posix.time is 
src/druntime/src/core/sys/posix/time.d. From the little I've look at core 
though, the system stuff really isn't documented. It's pretty much just including 
proper declarations for C system stuff and giving a way for your to access it 
without directly putting the C declarations in your code yourself. It also deals 
with some of the differences on platforms, which can prove to be quite annoying - 
even among posix implementations.

Of course, the stuff you're looking for is standard C stuff, so you could just do 
it yourself directly - all it really requires is the function declarations. 
Check out http://www.digitalmars.com/d/2.0/interfaceToC.html for more details.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list