time

The time namespace contains functions that offer more precise timing related information. Lua only offers two time related methods by default which don’t offer much in regards to precision timing, or other useful time related info.

Functions exposed by this namespace are accessed via the prefix: hook.time.

Functions

clock

Returns the current high-resolution clock information. (Uses std::chrono::high_resolution_clock::now)

1table hook.time.clock();
Parameter NameTypeDescription
None.
Returns
(table) Table containing the high-resolution clock information.

The returned table contains the following properties:

  • s (number) - The number of seconds of the high-res clock.
  • ms (number) - The number of milli-seconds of the high-res clock.
  • micro (number) - The number of micro-seconds of the high-res clock.
  • nano (number) - The number of nano-seconds of the high-res clock.

query_performance_counter, qpc

Returns a table containing the current performance counter information. (Uses QueryPerformanceCounter)

1table hook.time.query_performance_counter();
2table hook.time.qpc();
Parameter NameTypeDescription
None.
Returns
(table) Table containing the current performance counter information.

The returned table contains the following properties:

  • quad_part (number) - The performance counter quad part.
  • high_part (number) - The performance counter high part.
  • low_part (number) - The performance counter low part.
  • q (number) - The performance counter quad part. (Shorthand naming.)
  • h (number) - The performance counter high part. (Shorthand naming.)
  • l (number) - The performance counter low part. (Shorthand naming.)

query_performance_frequency, qpf

Returns a table containing the current performance frequency information. (Uses QueryPerformanceFrequency)

1table hook.time.query_performance_frequency();
2table hook.time.qpf();
Parameter NameTypeDescription
None.
Returns
(table) Table containing the current performance frequency information.

The returned table contains the following properties:

  • quad_part (number) - The performance frequency quad part.
  • high_part (number) - The performance frequency high part.
  • low_part (number) - The performance frequency low part.
  • q (number) - The performance frequency quad part. (Shorthand naming.)
  • h (number) - The performance frequency high part. (Shorthand naming.)
  • l (number) - The performance frequency low part. (Shorthand naming.)

get_local_time, glt

Returns a table containing the current local time. (Uses GetLocalTime)

1table hook.time.get_local_time();
2table hook.time.glt();
Parameter NameTypeDescription
None.
Returns
(table) Table containing the current local time information.

The returned table contains the following properties:

  • year (number) - The local time year value.
  • month (number) - The local time month value.
  • dayofweek (number) - The local time day of week value.
  • day (number) - The local time day value.
  • hour (number) - The local time hour value.
  • minute (number) - The local time minute value.
  • second (number) - The local time second value.
  • ms (number) - The local time millisecond value.
  • y (number) - The local time year value.
  • m (number) - The local time month value.
  • wd (number) - The local time day of week value.
  • d (number) - The local time day value.
  • hh (number) - The local time hour value.
  • mm (number) - The local time minute value.
  • ss (number) - The local time second value.

get_system_time, gst

Returns a table containing the current system time. (Uses GetSystemTime)

1table hook.time.get_system_time();
2table hook.time.gst();
Parameter NameTypeDescription
None.
Returns
(table) Table containing the current system time information.

The returned table contains the following properties:

  • year (number) - The system time year value.
  • month (number) - The system time month value.
  • dayofweek (number) - The system time day of week value.
  • day (number) - The system time day value.
  • hour (number) - The system time hour value.
  • minute (number) - The system time minute value.
  • second (number) - The system time second value.
  • ms (number) - The system time millisecond value.
  • y (number) - The system time year value.
  • m (number) - The system time month value.
  • wd (number) - The system time day of week value.
  • d (number) - The system time day value.
  • hh (number) - The system time hour value.
  • mm (number) - The system time minute value.
  • ss (number) - The system time second value.

get_tick, tick

Returns the current system tick count. (Uses GetTickCount)

1table hook.time.get_tick();
2table hook.time.tick();
Parameter NameTypeDescription
None.
Returns
(number) The current system tick count.

get_tick64, tick64

Returns the current system tick count. (Uses GitTickCount64)

1table hook.time.get_tick64();
2table hook.time.tick64();
Parameter NameTypeDescription
None.
Returns
(number) The current system tick count.