getting current DateTime

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 2 05:31:11 PST 2015


On 1/2/15 6:21 AM, Jonathan M Davis via Digitalmars-d-learn wrote:

> The main places that code is likely to use DateTime is if it needs to
> operate on dates and times separately from any connection to the system's
> time or time zones and when you want to get the separate pieces of the
> date and time (year, month, etc.) efficiently, because converting to
> DateTime calculates that information once, whereas calling each individual
> property on SysTime results in having to do some of the calculations
> multiple times if you want to access multiple of the properties (which
> sometimes makes me think that I never should have put those properties on
> SysTime in the first place, but it's convenient if you don't care about the
> small loss of efficiency when duplicating some of the calculations to get
> multiple of the properties or you only need one or two of the properties).

Not sure if you saw it, but I think a question for you Jonathan, is why 
DateTime ignores subsecond data? Wouldn't it be trivial to include that too?

It seems to be a conflict to say, either I want to efficiently work with 
components, or I want subsecond resolution. Even if subseconds was a 
single value to deal with (like a Duration).

I personally have not used DateTime, as SysTime fits my needs quite well.

-Steve


More information about the Digitalmars-d-learn mailing list