pub struct ClockType(/* private fields */);
Expand description

This enum contains the different clock types that QElapsedTimer may use.

C++ enum: QElapsedTimer::ClockType.

C++ documentation:

This enum contains the different clock types that QElapsedTimer may use.

QElapsedTimer will always use the same clock type in a particular machine, so this value will not change during the lifetime of a program. It is provided so that QElapsedTimer can be used with other non-Qt implementations, to guarantee that the same reference clock is being used.

SystemTime

The system time clock is purely the real time, expressed in milliseconds since Jan 1, 1970 at 0:00 UTC. It's equivalent to the value returned by the C and POSIX time function, with the milliseconds added. This clock type is currently only used on Unix systems that do not support monotonic clocks (see below).

This is the only non-monotonic clock that QElapsedTimer may use.

MonotonicClock

This is the system's monotonic clock, expressed in milliseconds since an arbitrary point in the past. This clock type is used on Unix systems which support POSIX monotonic clocks (_POSIX_MONOTONIC_CLOCK).

This clock does not overflow.

TickCounter

The tick counter clock type is based on the system's or the processor's tick counter, multiplied by the duration of a tick. This clock type is used on Windows platforms. If the high-precision performance counter is available on Windows, the PerformanceCounter clock type is used instead.

The TickCounter clock type is the only clock type that may overflow. Windows Vista and Windows Server 2008 support the extended 64-bit tick counter, which allows avoiding the overflow.

On Windows systems, the clock overflows after 2^32 milliseconds, which corresponds to roughly 49.7 days. This means two processes' reckoning of the time since the reference may be different by multiples of 2^32 milliseconds. When comparing such values, it's recommended that the high 32 bits of the millisecond count be masked off.

MachAbsoluteTime

This clock type is based on the absolute time presented by Mach kernels, such as that found on macOS. This clock type is presented separately from MonotonicClock since macOS and iOS are also Unix systems and may support a POSIX monotonic clock with values differing from the Mach absolute time.

This clock is monotonic and does not overflow.

PerformanceCounter

This clock uses the Windows functions QueryPerformanceCounter and QueryPerformanceFrequency to access the system's high-precision performance counter. Since this counter may not be available on all systems, QElapsedTimer will fall back to the TickCounter clock automatically, if this clock cannot be used.

This clock is monotonic and does not overflow.

See also clockType() and isMonotonic().

Implementations§

source§

impl ClockType

source

pub fn to_int(&self) -> c_int

source§

impl ClockType

source

pub const SystemTime: ClockType = _

The human-readable system time. This clock is not monotonic. (C++ enum variant: SystemTime = 0)

source

pub const MonotonicClock: ClockType = _

The system’s monotonic clock, usually found in Unix systems. This clock is monotonic and does not overflow. (C++ enum variant: MonotonicClock = 1)

source

pub const TickCounter: ClockType = _

The system’s tick counter, used on Windows systems. This clock may overflow. (C++ enum variant: TickCounter = 2)

source

pub const MachAbsoluteTime: ClockType = _

The Mach kernel’s absolute time (macOS and iOS). This clock is monotonic and does not overflow. (C++ enum variant: MachAbsoluteTime = 3)

source

pub const PerformanceCounter: ClockType = _

The high-resolution performance counter provided by Windows. This clock is monotonic and does not overflow. (C++ enum variant: PerformanceCounter = 4)

Trait Implementations§

source§

impl Clone for ClockType

source§

fn clone(&self) -> ClockType

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ClockType

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<ClockType> for c_int

source§

fn from(value: ClockType) -> Self

Converts to this type from the input type.
source§

impl From<i32> for ClockType

source§

fn from(value: c_int) -> Self

Converts to this type from the input type.
source§

impl PartialEq for ClockType

source§

fn eq(&self, other: &ClockType) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for ClockType

source§

impl Eq for ClockType

source§

impl StructuralEq for ClockType

source§

impl StructuralPartialEq for ClockType

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.