Time

Represents a time value

The Time struct encapsulates a time value in a flexible way.

It allows to define a time value either as a number of seconds, milliseconds or microseconds. It also works the other way round: you can read a time value as either a number of seconds, milliseconds or microseconds.

By using such a flexible interface, the API doesn't impose any fixed type or resolution for time values, and let the user choose its own favorite representation.

Time values support the usual mathematical operations: you can add or subtract two times, multiply or divide a time by a number, compare two times, etc.

Since they represent a time span and not an absolute time value, times can also be negative.

Constructors

this
this(long microseconds)
Undocumented in source.

Members

Functions

asMicroseconds
long asMicroseconds()

Return the time value as a number of microseconds.

asMilliseconds
int asMilliseconds()

Return the time value as a number of milliseconds.

asSeconds
float asSeconds()

Return the time value as a number of seconds.

opBinary
Time opBinary(E num)
Undocumented in source. Be warned that the author may not have intended to support it.
opBinary
Time opBinary(Time rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opCmp
int opCmp(Time rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Time rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
Time opOpAssign(Time rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
Time opOpAssign(E num)
Undocumented in source. Be warned that the author may not have intended to support it.
opUnary
Time opUnary()
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

Zero
immutable(Time) Zero;

Predefined "zero" time value.

Meta