digitalmars.D.learn - tiny std.datetime question
- n00b (7/7) Jan 16 2013 Hello, I'm kinda ashamed to ask that here, but std.datetime
- n00b (4/11) Jan 16 2013 Nevermind, found it myself.
- Jonathan M Davis (19/32) Jan 16 2013 Do you mean time_t (I've never heard of t_time)? You'll need to call=20=
- n00b (2/27) Jan 16 2013 Thanks a lot for that information! ( and yes I meant time_t )
- Minas Mina (5/18) Jan 16 2013 This is a better way, that doesn't allocate memory:
- Rob T (8/10) Jan 16 2013 You'll likely have a much easier time reading this.
- Jonathan M Davis (7/19) Jan 16 2013 std.datetime is pretty much the poster child for why the current format ...
- Rob T (12/36) Jan 16 2013 Yeah, I was amazed at how much simpler things became after better
- Jonathan M Davis (10/19) Jan 16 2013 I'd still like to break it up a bit, but I'm not going to do it unless s...
- Rob T (8/15) Jan 17 2013 Yes, a complex module or multi-feature module could just have the
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;
Jan 16 2013
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;
Jan 16 2013
On Wednesday, January 16, 2013 09:15:39 n00b wrote:Nevermind, found it myself. SysTime* sys =3D new SysTime(standardTime, UTC()); sys.hour; =20 Le 16/01/2013 08:07, n00b a =C3=A9crit :aHello, I'm kinda ashamed to ask that here, but std.datetime documentation is so complex... I only want to get hour/minute from =Do you mean time_t (I've never heard of t_time)? You'll need to call=20= unixTimeToStdTime on a time_t if you want to pass it to SysTime's const= ructor.=20 And if you need to be careful of time_t if you're on Windows, because=20= Microsoft screwed it up (for some bizarre reason, they apply DST to tim= e_t -=20 DST in the _local_ time zone - making it so that the offset between the= local=20 time and time_t is always the same instead of making time_t UTC like it= 's=20 supposed to be). std.datetime assumes that you're dealing with a true t= ime_t=20 which is in UTC if you give it a time_t. Also, if you haven't already, = you=20 should read this article on std.datetime: http://dlang.org/intro-to-datetime.html - Jonathan m Davist_time (no timezone). I'm moving to D2, the equivalent code in D1 was: =20 std.date.Date date; date.parse(std.date.toUTCString(time)); date.hour;
Jan 16 2013
Le 16/01/2013 10:54, Jonathan M Davis a écrit :On Wednesday, January 16, 2013 09:15:39 n00b wrote:Thanks a lot for that information! ( and yes I meant time_t )Nevermind, found it myself. SysTime* sys = new SysTime(standardTime, UTC()); sys.hour; Le 16/01/2013 08:07, n00b a écrit :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 DavisHello, 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;
Jan 16 2013
On Wednesday, 16 January 2013 at 14:15:46 UTC, n00b wrote:Nevermind, found it myself. SysTime* sys = new SysTime(standardTime, UTC()); sys.hour; Le 16/01/2013 08:07, n00b a écrit :This is a better way, that doesn't allocate memory: auto clock = Clock.currTime(); writeln(clock.hour); :)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;
Jan 16 2013
On Wednesday, 16 January 2013 at 13:07:48 UTC, n00b wrote:Hello, I'm kinda ashamed to ask that here, but std.datetime documentation is so complex...You'll likely have a much easier time reading this. http://vibed.org/temp/d-programming-language.org/phobos/std/datetime.html Those pages are experimental upgrades to the current documentation generator. The docs should be a complete duplicate of the library documentation in here, it's just formatted a lot better. I hope we'll see this soon in here. --rt
Jan 16 2013
On Thursday, January 17, 2013 07:15:14 Rob T wrote:On Wednesday, 16 January 2013 at 13:07:48 UTC, n00b wrote:std.datetime is pretty much the poster child for why the current format for the official documentation needs to be fixed. What's there really isn't all that complicated, and it's well-documented, but it's just too hard to sift through it all when all you have other than reading the entire page is a bunch of unorganized, near useless links at the top. - Jonathan M DavisHello, I'm kinda ashamed to ask that here, but std.datetime documentation is so complex...You'll likely have a much easier time reading this. http://vibed.org/temp/d-programming-language.org/phobos/std/datetime.html Those pages are experimental upgrades to the current documentation generator. The docs should be a complete duplicate of the library documentation in here, it's just formatted a lot better. I hope we'll see this soon in here.
Jan 16 2013
On Thursday, 17 January 2013 at 06:26:21 UTC, Jonathan M Davis wrote:On Thursday, January 17, 2013 07:15:14 Rob T wrote:Yeah, I was amazed at how much simpler things became after better formatting and organization was applied. Beforehand people were asking for std.datetime to be broken up, but no need anymore, although maybe the part on benchmarking and related (eg stopwatch) should be moved to its own module because those parts don't seem to really belong in there. I hope the effort to move to the new format has not been stalled, as I have not seen much about it in a while. Do you know what the status is? --rtOn Wednesday, 16 January 2013 at 13:07:48 UTC, n00b wrote:std.datetime is pretty much the poster child for why the current format for the official documentation needs to be fixed. What's there really isn't all that complicated, and it's well-documented, but it's just too hard to sift through it all when all you have other than reading the entire page is a bunch of unorganized, near useless links at the top. - Jonathan M DavisHello, I'm kinda ashamed to ask that here, but std.datetime documentation is so complex...You'll likely have a much easier time reading this. http://vibed.org/temp/d-programming-language.org/phobos/std/datetime.html Those pages are experimental upgrades to the current documentation generator. The docs should be a complete duplicate of the library documentation in here, it's just formatted a lot better. I hope we'll see this soon in here.
Jan 16 2013
On Thursday, January 17, 2013 07:57:51 Rob T wrote:Yeah, I was amazed at how much simpler things became after better formatting and organization was applied. Beforehand people were asking for std.datetime to be broken up, but no need anymore, although maybe the part on benchmarking and related (eg stopwatch) should be moved to its own module because those parts don't seem to really belong in there.I'd still like to break it up a bit, but I'm not going to do it unless some variant of DIP15 or DIP16 is implemented so that it can be done without breaking any code. So, it probably won't be broken up any time soon. It's not a big an issue though when the documentation is broken up.I hope the effort to move to the new format has not been stalled, as I have not seen much about it in a while. Do you know what the status is?No idea. Andrei was pushing for various changes to the vibe stuff before actually changing the official docs, and some work was done on that, but I don't know where it stands now. Everything I know about it is from the thread where it was being discussed a few weeks ago. - Jonathan M Davis
Jan 16 2013
On Thursday, 17 January 2013 at 07:17:57 UTC, Jonathan M Davis wrote:I'd still like to break it up a bit, but I'm not going to do it unless some variant of DIP15 or DIP16 is implemented so that it can be done without breaking any code. So, it probably won't be broken up any time soon. It's not a big an issue though when the documentation is broken up.Yes, a complex module or multi-feature module could just have the docs broken up into separate sections, however those DIPs you mention look to me like they are definitely worth implementing. There's a lot of value being able to structure and organize your code better. --rt
Jan 17 2013