Josh Posted March 16, 2021 Share Posted March 16, 2021 I believe this function will give you the number of seconds since January 1, 1601: uint64_t SystemTime() { SYSTEMTIME timestamp; GetSystemTime(×tamp); FILETIME filetime; SystemTimeToFileTime(×tamp, &filetime); uint64_t timetime; Assert(sizeof(timetime) == sizeof(filetime)); memcpy(&timetime, &filetime, sizeof(timetime)); return timetime / 10000000; } Unlike Millisecs(), this function does not change results when the computer restarts, so you can compare values across machines or store them in setting files. https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-systemtime 3 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted March 16, 2021 Author Share Posted March 16, 2021 Quick test seems to work: int main(int argc, const char* argv[]) { auto tm = SystemTime(); while (true) { auto newtime = SystemTime(); if (newtime != tm) { tm = newtime; Print(tm); } Sleep(1); } return 0; } 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Robert_d1968 Posted March 17, 2021 Share Posted March 17, 2021 Is this for Ultra App Kit? I would like to use this function in there if it is.. Thanks, Robert PS. I see it is in C++ language but it does not define what goes where. IE. the fist box of code and the second box of code. Quote Link to comment Share on other sites More sharing options...
Josh Posted March 18, 2021 Author Share Posted March 18, 2021 It's just a C++ function that can be used anywhere. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.