Replace platform-specific GetMilliseconds using std::chrono.
This commit is contained in:
parent
a4a121694c
commit
b0d37c1e78
|
@ -70,17 +70,6 @@ std::string CnfThawString(const std::string &val, const std::string &key) {
|
||||||
|
|
||||||
/* Timer */
|
/* Timer */
|
||||||
|
|
||||||
int64_t SolveSpace::GetMilliseconds(void) {
|
|
||||||
clock_serv_t cclock;
|
|
||||||
mach_timespec_t mts;
|
|
||||||
|
|
||||||
host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock);
|
|
||||||
clock_get_time(cclock, &mts);
|
|
||||||
mach_port_deallocate(mach_task_self(), cclock);
|
|
||||||
|
|
||||||
return mts.tv_sec * 1000 + mts.tv_nsec / 1000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
@interface DeferredHandler : NSObject
|
@interface DeferredHandler : NSObject
|
||||||
+ (void) runLater:(id)dummy;
|
+ (void) runLater:(id)dummy;
|
||||||
+ (void) runCallback;
|
+ (void) runCallback;
|
||||||
|
@ -1363,7 +1352,7 @@ static void connexionClose() {
|
||||||
|
|
||||||
unregisterConnexionClient(connexionClient);
|
unregisterConnexionClient(connexionClient);
|
||||||
cleanupConnexionHandlers();
|
cleanupConnexionHandlers();
|
||||||
|
|
||||||
CFRelease(spaceBundle);
|
CFRelease(spaceBundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,12 +194,6 @@ static void CnfThawWindowPos(Gtk::Window *win, const std::string &key) {
|
||||||
|
|
||||||
/* Timers */
|
/* Timers */
|
||||||
|
|
||||||
int64_t GetMilliseconds(void) {
|
|
||||||
struct timespec ts;
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
|
||||||
return 1000 * (uint64_t) ts.tv_sec + ts.tv_nsec / 1000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool TimerCallback() {
|
static bool TimerCallback() {
|
||||||
SS.GW.TimerCallback();
|
SS.GW.TimerCallback();
|
||||||
SS.TW.TimerCallback();
|
SS.TW.TimerCallback();
|
||||||
|
|
|
@ -772,15 +772,6 @@ bool SolveSpace::FullScreenIsActive()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t SolveSpace::GetMilliseconds()
|
|
||||||
{
|
|
||||||
LARGE_INTEGER t, f;
|
|
||||||
QueryPerformanceCounter(&t);
|
|
||||||
QueryPerformanceFrequency(&f);
|
|
||||||
LONGLONG d = t.QuadPart/(f.QuadPart/1000);
|
|
||||||
return (int64_t)d;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SolveSpace::InvalidateText()
|
void SolveSpace::InvalidateText()
|
||||||
{
|
{
|
||||||
InvalidateRect(TextWnd, NULL, false);
|
InvalidateRect(TextWnd, NULL, false);
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <chrono>
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
# include <windows.h> // required by GL headers
|
# include <windows.h> // required by GL headers
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -61,6 +61,12 @@ bool SolveSpace::FilenameHasExtension(const std::string &str, const char *ext)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t SolveSpace::GetMilliseconds()
|
||||||
|
{
|
||||||
|
auto timestamp = std::chrono::steady_clock::now().time_since_epoch();
|
||||||
|
return std::chrono::duration_cast<std::chrono::milliseconds>(timestamp).count();
|
||||||
|
}
|
||||||
|
|
||||||
void SolveSpace::MakeMatrix(double *mat,
|
void SolveSpace::MakeMatrix(double *mat,
|
||||||
double a11, double a12, double a13, double a14,
|
double a11, double a12, double a13, double a14,
|
||||||
double a21, double a22, double a23, double a24,
|
double a21, double a22, double a23, double a24,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user