digitalmars.D.learn - Is unix time function in wrong module?
- Martin (12/12) May 19 2021 Hi,
- =?UTF-8?Q?Ali_=c3=87ehreli?= (15/17) May 19 2021 I wouldn't expect those modules to publicly import unix time function.
Hi, shouldn't the unix time functions be in std.datetime.Date and std.datetime.DateTime instead of std.datetime.SysTime? The documentation states: - "std.datetime.systime for a point in time with a timezone." - "std.datetime.date for points in time without timezones." Unix epoch is 00:00:00 UTC on 1 January 1970 - and UTC is a standard, not a timezone. if i am not mistaken timezones getting applied on UTC - so i do not understand why the unix time functions are in the modules which are "timezone aware" and not in the modules without a timezone awareness.
May 19 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
May 19 2021