ReXGlue SDK
Loading...
Searching...
No Matches
rex::Clock Class Reference

#include <rex/chrono.h>

Static Public Member Functions

static bool IsNoScaling ()
static u64 GetHostTickFrequency () noexcept
static u64 GetHostTickCount () noexcept
static u64 QueryHostSystemTime () noexcept
static u64 QueryHostUptimeMillis ()
static f64 GetGuestTimeScalar ()
static void SetGuestTimeScalar (f64 scalar)
static std::pair< u64, u64 > GetGuestTickRatio ()
static u64 GetGuestTickFrequency ()
static void SetGuestTickFrequency (u64 frequency)
static u64 GetGuestSystemTimeBase ()
static void SetGuestSystemTimeBase (u64 time_base)
static u64 QueryGuestTickCount ()
static u64 QueryGuestSystemTime ()
static u32 GetGuestUptimeMillis ()
static void SetGuestSystemTime (u64 system_time)
static u32 ScaleGuestDurationMillis (u32 guest_ms)
static i64 ScaleGuestDurationFileTime (i64 guest_file_time)
static void ScaleGuestDurationTimeval (i32 *tv_sec, i32 *tv_usec)

Detailed Description

Host clock queries and the scaled guest clock.

Member Function Documentation

◆ GetGuestSystemTimeBase()

u64 rex::Clock::GetGuestSystemTimeBase ( )
static

Returns the FILETIME base of the guest system time. It defaults to the host system time at startup.

◆ GetGuestTickRatio()

std::pair< u64, u64 > rex::Clock::GetGuestTickRatio ( )
static
Returns
The host to guest tick ratio with time scaling applied, as a reduced numerator and denominator pair.

◆ GetGuestTimeScalar()

f64 rex::Clock::GetGuestTimeScalar ( )
static

Returns the guest time scalar. 1 is normal speed.

◆ GetGuestUptimeMillis()

u32 rex::Clock::GetGuestUptimeMillis ( )
static

Returns the title uptime in milliseconds. The time is scaled and clamped to the u32 range.

◆ IsNoScaling()

bool rex::Clock::IsNoScaling ( )
static

Reports whether guest time follows host time unscaled.

Returns
True when the clock.no_scaling cvar is set.

◆ QueryGuestSystemTime()

u64 rex::Clock::QueryGuestSystemTime ( )
static
Returns
The guest system time as a scaled FILETIME. It equals host system time when no_scaling is true.

◆ QueryGuestTickCount()

u64 rex::Clock::QueryGuestTickCount ( )
static

Advances and reads the guest tick count, with frequency adjustment and scaling applied.

◆ QueryHostSystemTime()

u64 rex::Clock::QueryHostSystemTime ( )
staticnoexcept
Returns
The host system time as a FILETIME, in 100ns units since Jan 1 1601.

◆ QueryHostUptimeMillis()

u64 rex::Clock::QueryHostUptimeMillis ( )
static

Returns the host uptime in milliseconds.

◆ ScaleGuestDurationFileTime()

i64 rex::Clock::ScaleGuestDurationFileTime ( i64 guest_file_time)
static

Scales a guest FILETIME duration by the time scalar. A positive value is an absolute time, scaled by its offset from the current guest system time. A negative value is a relative duration.

Parameters
guest_file_timeThe guest time in 100ns units.
Returns
The scaled time in 100ns units.

◆ ScaleGuestDurationMillis()

u32 rex::Clock::ScaleGuestDurationMillis ( u32 guest_ms)
static

Scales a guest duration in milliseconds by the time scalar.

Returns
The scaled duration, clamped to the u32 range.

◆ ScaleGuestDurationTimeval()

void rex::Clock::ScaleGuestDurationTimeval ( i32 * tv_sec,
i32 * tv_usec )
static

Scales a guest timeval duration in place by the time scalar.

Parameters
tv_secThe seconds field, read and written.
tv_usecThe microseconds field, read and written.

◆ SetGuestSystemTime()

void rex::Clock::SetGuestSystemTime ( u64 system_time)
static

Sets the guest system time by moving the time base. Ignored when no_scaling is true.

Parameters
system_timeThe new guest system time as a FILETIME.

◆ SetGuestSystemTimeBase()

void rex::Clock::SetGuestSystemTimeBase ( u64 time_base)
static

Sets the FILETIME base the guest system time counts from.

Parameters
time_baseThe new base as a FILETIME.

◆ SetGuestTickFrequency()

void rex::Clock::SetGuestTickFrequency ( u64 frequency)
static

Sets the guest tick frequency and recomputes the tick ratio.

Parameters
frequencyGuest ticks per second.

◆ SetGuestTimeScalar()

void rex::Clock::SetGuestTimeScalar ( f64 scalar)
static

Sets the guest time scalar. 2 runs at double speed and 0.5 at half speed. Ignored when no_scaling is true.


The documentation for this class was generated from the following file: