diff options
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/bbslua.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/mbbsd/bbslua.c b/mbbsd/bbslua.c index 5567c53e..dd1e2ded 100644 --- a/mbbsd/bbslua.c +++ b/mbbsd/bbslua.c @@ -580,12 +580,18 @@ bl_clock(lua_State *L) { double d = 0; -#ifdef _WIN32 - - DWORD ms = timeGetTime() % 1000; - syncnow(); - d = now + ms / 1000.0f; - +#ifdef _WIN32
+
+ // XXX this is a fast hack because we don't want to do 64bit calculation. + SYSTEMTIME st; + GetSystemTime(&st);
+ syncnow();
+ // XXX the may be some latency between our GetSystemTime and syncnow.
+ // So build again the "second" part.
+ d = (int)((now / 60) * 60);
+ d += st.wSecond;
+ d += (st.wMilliseconds / 1000.0f);
+
#else // !_WIN32 struct timeval tp; |