View source code
Display the source code in core/time.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Function core.time.Duration.total
Returns the total
number of the given units in this
.
So, unlike Duration
, it does not strip out the larger units.
split
Prototype
long total(string units)() const nothrow @nogc @property if (units == "weeks" || units == "days" || units == "hours" || units == "minutes" || units == "seconds" || units == "msecs" || units == "usecs" || units == "hnsecs" || units == "nsecs");
Example
assert(dur!"weeks"(12).total!"weeks" == 12); assert(dur!"weeks"(12).total!"days" == 84); assert(dur!"days"(13).total!"weeks" == 1); assert(dur!"days"(13).total!"days" == 13); assert(dur!"hours"(49).total!"days" == 2); assert(dur!"hours"(49).total!"hours" == 49); assert(dur!"nsecs"(2007).total!"hnsecs" == 20); assert(dur!"nsecs"(2007).total!"nsecs" == 2000);
Authors
Jonathan M Davis and Kato Shoichi