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.

Alias core.time.usecs

These allow you to construct a Duration from the given time units with the given length.

You can either use the generic function dur and give it the units as a string or use the named aliases.

The possible values for units are "weeks", "days", "hours", "minutes", "seconds", "msecs" (milliseconds), "usecs", (microseconds), "hnsecs" (hecto-nanoseconds, i.e. 100 ns), and "nsecs".

Declaration

alias usecs;

Parameters

NameDescription
units The time units of the Duration (e.g. "days").
length The number of units in the Duration.

Example

// Generic
assert(dur!"weeks"(142).total!"weeks" == 142);
assert(dur!"days"(142).total!"days" == 142);
assert(dur!"hours"(142).total!"hours" == 142);
assert(dur!"minutes"(142).total!"minutes" == 142);
assert(dur!"seconds"(142).total!"seconds" == 142);
assert(dur!"msecs"(142).total!"msecs" == 142);
assert(dur!"usecs"(142).total!"usecs" == 142);
assert(dur!"hnsecs"(142).total!"hnsecs" == 142);
assert(dur!"nsecs"(142).total!"nsecs" == 100);

// Non-generic
assert(weeks(142).total!"weeks" == 142);
assert(days(142).total!"days" == 142);
assert(hours(142).total!"hours" == 142);
assert(minutes(142).total!"minutes" == 142);
assert(seconds(142).total!"seconds" == 142);
assert(msecs(142).total!"msecs" == 142);
assert(usecs(142).total!"usecs" == 142);
assert(hnsecs(142).total!"hnsecs" == 142);
assert(nsecs(142).total!"nsecs" == 100);

Authors

Jonathan M Davis and Kato Shoichi

License

Boost License 1.0.

Comments