April 19, 2015
Hi

Is there a reason for the TimeOfDay struct, and in return DateTime struct to not hold the milliseconds of a given time?

Thanks


April 19, 2015
On Sunday, April 19, 2015 22:40:27 Muhammad Adel via phobos wrote:
> Hi
>
> Is there a reason for the TimeOfDay struct, and in return DateTime struct to not hold the milliseconds of a given time?

Because TimeOfDay, Date, and DateTime are intended for calendar-based operations. Milliseconds is far more precision than is needed for that, and including it would just make those data structures larger for little benefit.

Anything relating to the system's clock should use SysTime, which has hecto-nanosecond precision (100 ns). It's what Clock.currTime() returns and what most programs should be using. If you're not doing a bunch of calendar-based operations (like a calendar app would be doing), I would expect the primary use case of TimeOfDay, Date, and SysTime would be to get the various units of time from a SysTime efficiently rather than having to redo the calculations over and over again as would occur if you asked for them each indivdually from a SysTime.

Maybe TimeOfDay should have more precise units, but in general, if you're asking why it doesn't have them, you're probably using the wrong type anyway and should be using SysTime.

Also, questions like this are better asked in the Learn newsgroup, not Phobos. Phobos is intended for discussions between the Phobos developers and for those who wish to receive the commit messages for Phobos (and mostly just the latter now that we use github). There is very little posting to the Phobos list by humans these days.

- Jonathan M Davis

_______________________________________________
phobos mailing list
phobos@puremagic.com
http://lists.puremagic.com/mailman/listinfo/phobos