Article Review: Migrating from std.date to std.datetime

Jonathan M Davis jmdavisProg at gmx.com
Sun May 15 19:09:48 PDT 2011


On 2011-05-14 21:16, Jonathan M Davis wrote:
> It recently came to my attention that an article on converting code from
> using std.date to using std.datetime would be of value, so I wrote one up.
> Since it's an article, and it's within the time period set by Walter for
> the article contest, I guess that it's in the article contest, but I wrote
> it because it needed writing rather than for the contest. It might as well
> be part of the contest though.
> 
> In any case, I put it in my d-programming-language.org repository on
> github:
> https://github.com/jmdavis/d-programming-language.org/tree/article_datetim
> e
> 
> Or if you just want to download it without building
> d-programming-language.org yourself, go here: http://is.gd/jFAmDy
> 
> So, feel free to read it and give feeback on it. Hopefully it does its job
> fairly well. Writing it did give me some insight into a couple of tweaks
> that need to be made to std.datetime though. In particular, I really
> should come up with a better way to save time zones for those that care
> about restoring the _exact_ time zone that they had in the SysTime that
> they saved in a database or to disk or whatever. ISO is great for storing
> the exact time - including what the offset from UTC of the original time
> zone was - but it's not generally enough for restoring the exact time zone
> that you were dealing with in the first place. Most code won't care, but I
> really should find a way to do it. I knew about the problem, but it's
> definitely a pain to solve, so I left it alone. I should work on fixing
> that.
> 
> In any case, the article is now available for you to read and review.

I updated the article with an explanation as to why hnsecs are use in 
std.datetime. My github branch has been updated, and you can download the 
updated version here: http://is.gd/1ASHPD

- Jonathan M Davis


More information about the Digitalmars-d mailing list