std.datetime TimeOfDay missing 'add' method?
Jonathan M Davis
jmdavisProg at gmx.com
Thu Sep 20 09:38:05 PDT 2012
On Thursday, September 20, 2012 18:02:04 ixid wrote:
> TimeOfDay's roll function refers to an add method which would
> increment or decrement the next greater unit of time when it
> wraps a unit of time. This method seems to be absent, while
> DateTime has it.
Create a Duration and use +. e.g.
auto t = timeOfDay + dur!"seconds"(12);
Maybe rolling's docs aren't clear enough, but they never actually mention an
add function. They mention adding but not an add function.
An add method exists on SysTime, DateTime, and Date only because you can't
have a Duration of anything greater than weeks, because you can't convert
between months and smaller units without a specific date. So, a separate
function is needed. Everything else uses the arithmetic operators.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list