Struct core.time.TickDuration
Warning: TickDuration
will be deprecated in the near future (once all
uses of it in Phobos have been deprecated). Please use
MonoTime
for the cases where a monotonic timestamp is needed
and Duration
when a duration is needed, rather than using
TickDuration
. It has been decided that TickDuration
is too confusing
(e.g. it conflates a monotonic timestamp and a duration in monotonic
clock ticks) and that having multiple duration types is too awkward
and confusing.
Represents a duration of time in system clock ticks.
The system clock ticks are the ticks of the system clock at the highest precision that the system provides.
Constructors
Name | Description |
---|---|
this
|
Fields
Name | Type | Description |
---|---|---|
appOrigin
|
immutable(TickDuration) |
The tick of the system clock (as a ) when the
application started.
|
length
|
long |
The number of system ticks in this .
|
ticksPerSec
|
immutable(long) |
The number of ticks that the system clock has in one second. |
Properties
Name | Type | Description |
---|---|---|
currSystemTick
[get]
|
TickDuration |
The current system tick. The number of ticks per second varies from
system to system. uses a monotonic clock, so it's
intended for precision timing by comparing relative time values, not for
getting the current system time.
|
hnsecs
[get]
|
long |
Returns the total number of hecto-nanoseconds in this .
|
max
[get]
|
TickDuration |
Largest possible.
|
min
[get]
|
TickDuration |
Most negative possible.
|
msecs
[get]
|
long |
Returns the total number of milliseconds in this .
|
nsecs
[get]
|
long |
Returns the total number of nanoseconds in this .
|
seconds
[get]
|
long |
Returns the total number of seconds in this .
|
usecs
[get]
|
long |
Returns the total number of microseconds in this .
|
zero
[get]
|
TickDuration |
It's the same as , but it's provided to be
consistent with and , which provide
properties.
|
Methods
Name | Description |
---|---|
from
|
This allows you to construct a from the given time
units with the given length .
|
opBinary
|
Adds or subtracts two s.
|
opBinary
|
The legal types of arithmetic for using this operator
overload are
|
opBinary
|
The legal types of arithmetic for using this operator
overload are
|
opCast
|
Returns a Duration with the same number of hnsecs as this
.
Note that the conventional way to convert between
and is using std.conv.to , e.g.:
tickDuration.to!
|
opCmp
|
operator overloading "<, >, <=, >=" |
opOpAssign
|
Adds or subtracts two s as well as assigning the result
to this .
|
opOpAssign
|
The legal types of arithmetic for using this operator
overload are
|
opOpAssign
|
The legal types of arithmetic for using this operator
overload are
|
opUnary
|
Returns the negation of this .
|
Authors
Jonathan M Davis and Kato Shoichi