mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-09 14:00:17 +00:00
Currently main() includes logic that is intended to sync time() with GetTicks() for the purpose of using GetTicks() to get millisecond accuracy with time(), which only has second accuracy. Unfortunately, the 'syncing' up of these time sources results in an average of a half second delay in starting a QB64-PE program. This logic is easly replaced with std::chrono, which provides a real time clock which is also millisecond accurate. That removes the need to use time() and GetTicks() together to get millisecond accuracy, and means the delay syncing them is no longer necessary. I also separated most of the "delay" and "time" related functions into datetime.cpp, and included the new std::chrono code into that file. Since I needed to call some of the rounding functions in datetime.cpp I also moved that stuff out into its own .cpp and header files to clean things up a bit. Fixes: #282
15 lines
335 B
C
15 lines
335 B
C
#ifndef INCLUDE_LIBQB_DATETIME_H
|
|
#define INCLUDE_LIBQB_DATETIME_H
|
|
|
|
int64_t GetTicks();
|
|
|
|
double func_timer(double accuracy, int32_t passed);
|
|
void sub__delay(double seconds);
|
|
void sub__limit(double fps);
|
|
|
|
// We provide a 'Sleep()' function for non-Windows platforms
|
|
#ifndef QB64_WINDOWS
|
|
void Sleep(uint32_t milliseconds);
|
|
#endif
|
|
|
|
#endif
|