On Monday, 31 March 2014 at 06:25:40 UTC, Jonathan M Davis wrote:
On Monday, March 31, 2014 05:09:22 ed wrote:
Hi,
Just wondering what the best replacement for C timeval is in D.
I'm looking at std.datetime.SysTime, but std.datetime is huge
so
I'm not sure.
If you want an overview of std.datetime, read
http://dlang.org/intro-to-datetime.html
But yes, SysTime would be what you'd want to use instead of a
timeval. SysTime
is intended for representing the time of the system, whereas
DateTime, Date,
or TimeOfDay relate to specifically to calendar time (they have
no time zones
and therefore cannot be tied to a unique point in time - e.g. a
DateTime for
2014-03-30T12:00:00 could be one of over 24 different points in
time, as it
has no time zone to tie it down). SysTime holds its time
internally in UTC and
uses a TimeZone object to convert to to other time zones when
required (e.g.
when printing it out); it defaults to LocalTime, which
represents the local
time of your system.
SysTime also has a function called toTimeVal for converting to
a timeval if
you need to pass it to C code.
- Jonathan M Davis
Great info, thank you.
Cheers,
ed