Le 16/01/2013 10:54, Jonathan M Davis a écrit :
On Wednesday, January 16, 2013 09:15:39 n00b wrote:
Nevermind, found it myself.
SysTime* sys = new SysTime(standardTime, UTC());
sys.hour;
Le 16/01/2013 08:07, n00b a écrit :
Hello, I'm kinda ashamed to ask that here, but std.datetime
documentation is so complex... I only want to get hour/minute from a
t_time (no timezone).
I'm moving to D2, the equivalent code in D1 was:
std.date.Date date;
date.parse(std.date.toUTCString(time));
date.hour;
Do you mean time_t (I've never heard of t_time)? You'll need to call
unixTimeToStdTime on a time_t if you want to pass it to SysTime's constructor.
And if you need to be careful of time_t if you're on Windows, because
Microsoft screwed it up (for some bizarre reason, they apply DST to time_t -
DST in the _local_ time zone - making it so that the offset between the local
time and time_t is always the same instead of making time_t UTC like it's
supposed to be). std.datetime assumes that you're dealing with a true time_t
which is in UTC if you give it a time_t. Also, if you haven't already, you
should read this article on std.datetime:
http://dlang.org/intro-to-datetime.html
- Jonathan m Davis
Thanks a lot for that information! ( and yes I meant time_t )