2019-11-03 17:19:29 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2020-04-11 21:43:29 +00:00
|
|
|
extern int GameTicRate;
|
2020-09-27 06:30:28 +00:00
|
|
|
extern double TimeScale;
|
2020-04-11 21:43:29 +00:00
|
|
|
|
2022-10-09 12:50:45 +00:00
|
|
|
void I_InitTime();
|
|
|
|
|
2020-04-11 21:43:29 +00:00
|
|
|
// Called by D_DoomLoop, sets the time for the current frame
|
|
|
|
void I_SetFrameTime();
|
|
|
|
|
|
|
|
// Called by D_DoomLoop, returns current time in tics.
|
2021-08-01 13:02:13 +00:00
|
|
|
int I_GetTime(double const ticrate = GameTicRate);
|
2020-08-02 19:16:01 +00:00
|
|
|
// same, but using nanoseconds
|
|
|
|
uint64_t I_GetTimeNS();
|
2020-04-11 21:43:29 +00:00
|
|
|
|
2021-08-01 13:02:13 +00:00
|
|
|
double I_GetTimeFrac(double const ticrate = GameTicRate);
|
2020-04-11 21:43:29 +00:00
|
|
|
|
|
|
|
// like I_GetTime, except it waits for a new tic before returning
|
2021-08-01 13:02:13 +00:00
|
|
|
int I_WaitForTic(int prevtic, double const ticrate = GameTicRate);
|
2020-04-11 21:43:29 +00:00
|
|
|
|
|
|
|
// Freezes tic counting temporarily. While frozen, calls to I_GetTime()
|
|
|
|
// will always return the same value.
|
|
|
|
// You must also not call I_WaitForTic() while freezing time, since the
|
|
|
|
// tic will never arrive (unless it's the current one).
|
|
|
|
void I_FreezeTime(bool frozen);
|
|
|
|
|
2019-11-03 17:19:29 +00:00
|
|
|
// [RH] Returns millisecond-accurate time
|
|
|
|
uint64_t I_msTime();
|
|
|
|
|
2020-06-20 09:55:30 +00:00
|
|
|
// [RH] Returns nanosecond-accurate time in milliseconds
|
|
|
|
double I_msTimeF(void);
|
|
|
|
|
2020-04-11 21:43:29 +00:00
|
|
|
// [SP] Returns millisecond-accurate time from start
|
|
|
|
uint64_t I_msTimeFS();
|
|
|
|
|
2019-11-03 17:19:29 +00:00
|
|
|
// Nanosecond-accurate time
|
|
|
|
uint64_t I_nsTime();
|
2021-05-23 12:36:54 +00:00
|
|
|
|
|
|
|
// Reset the timer after a lengthy operation
|
|
|
|
void I_ResetFrameTime();
|
2021-11-12 07:59:52 +00:00
|
|
|
|
|
|
|
// Return a decimal fraction to scale input operations at framerate
|
2022-06-06 08:26:24 +00:00
|
|
|
double I_GetInputFrac(bool const synchronised);
|
2021-11-12 07:59:52 +00:00
|
|
|
|
|
|
|
// Reset the last input check to after a lengthy operation
|
|
|
|
void I_ResetInputTime();
|
2022-04-25 09:13:55 +00:00
|
|
|
|
|
|
|
// Pause a bit.
|
|
|
|
// [RH] Despite the name, it apparently never waited for the VBL, even in
|
|
|
|
// the original DOS version (if the Heretic/Hexen source is any indicator).
|
|
|
|
void I_WaitVBL(int count);
|