Is unix time function in wrong module?

Ali Çehreli acehreli at yahoo.com
Wed May 19 21:52:22 UTC 2021


On 5/19/21 12:18 PM, Martin wrote:

 > shouldn't the unix time functions be in std.datetime.Date and
 > std.datetime.DateTime instead of std.datetime.SysTime?

I wouldn't expect those modules to publicly import unix time function. 
Such functions are found under the core.sys package:

import std.stdio;
import core.sys.linux.time;

// This is publicly imported by core.sys.linux.time:
// import core.sys.posix.time;

void main() {
   time_t t;
   writeln(time(&t));
   writeln(t);
}

The problem is, the location for these functions are not well 
documented. So, I simply grep under /usr/include/dmd and it usually works.

Ali



More information about the Digitalmars-d-learn mailing list