xecs.Duration#
- class xecs.Duration#
Bases:
object
Represents a span of time.
Methods
Return the total number of whole microseconds in this duration.
Return the total number of whole milliseconds in this duration.
Return the total number of whole nanoseconds in this duration.
Return the total number of whole seconds in the duration.
Add a duration inplace.
Divide a duration inplace.
Multiply a duration inplace.
Subtract a duration inplace.
Create a new duration from a specified number of microseconds.
Create a new duration from a specified number of milliseconds.
Create a new duration from a specified number of nanoseconds.
Return
True
if the duration spans no time.Create a new duration.
Subtract a duration.
Return the fractional part of this duration, in whole microseconds.
Return the fractional part of this duration, in whole nanoseconds.
- as_micros()#
Return the total number of whole microseconds in this duration.
- Returns:
The number of whole microseconds.
- Return type:
- as_millis()#
Return the total number of whole milliseconds in this duration.
- Returns:
The number of whole milliseconds.
- Return type:
- as_nanos()#
Return the total number of whole nanoseconds in this duration.
- Returns:
The number of whole nanoseconds.
- Return type:
- as_secs()#
Return the total number of whole seconds in the duration.
- Returns:
The total number of whole seconds.
- Return type:
- static from_micros(micros)#
Create a new duration from a specified number of microseconds.
- static from_millis(millis)#
Create a new duration from a specified number of milliseconds.
- static from_nanos(nanos)#
Create a new duration from a specified number of nanoseconds.
- is_zero()#
Return
True
if the duration spans no time.- Returns:
Whether the duration spans any time or not.
- Return type:
- static new(secs, nanos)#
Create a new duration.
- saturating_sub(rhs)#
Subtract a duration.
- subsec_micros()#
Return the fractional part of this duration, in whole microseconds.
This method does not return the lenght of the duration when represented by microseconds. The returned number always represents a fractional portion of a second.
- Returns:
The subsecond microseconds in the duration.
- Return type:
- subsec_nanos()#
Return the fractional part of this duration, in whole nanoseconds.
This method does not return the lenght of the duration when represented by nanoseconds. The returned number always represents a fractional portion of a second.
- Returns:
The subsecond nanoseconds in the duration.
- Return type: