Skip to content

Commit c22df9c

Browse files
committed
boot time in ms
1 parent d2c8629 commit c22df9c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

source/gameanalytics/Platform/GAMacOS.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,9 @@ int64_t gameanalytics::GAPlatformMacOS::getBootTime() const
259259
struct timeval currentTime = {};
260260

261261
gettimeofday(&currentTime, NULL);
262-
263-
return currentTime.tv_sec - startTime.tv_sec;
262+
263+
int64_t remainingMs = static_cast<double>(currentTime.tv_usec - startTime.tv_usec) * 1e-3;
264+
return (currentTime.tv_sec - startTime.tv_sec) * 1000 + remainingMs;
264265
}
265266

266267
#endif

source/gameanalytics/Platform/GAWin32.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ int64_t GAPlatformWin32::getBootTime() const
332332

333333
// filetime is expressed in 100s of nanoseconds
334334
std::chrono::nanoseconds timeInNs = std::chrono::nanoseconds(value * 100);
335-
return std::chrono::duration_cast<std::chrono::seconds>(timeInNs).count();
335+
return std::chrono::duration_cast<std::chrono::milliseconds>(timeInNs).count();
336336
}
337337

338338
return 0ll;

0 commit comments

Comments
 (0)