Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
brinkqiang committed Dec 25, 2024
1 parent dfae8db commit ff1e79f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/dmtimermodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,13 @@ static inline uint32_t GetTickCount32() {

#ifdef _WIN32
static std::once_flag initializedFlag;
std::call_once(initializedFlag, []() { timeBeginPeriod(1); });
std::call_once(initializedFlag, []() {
static auto t = timeBeginPeriod(1);
std::atexit([](){
timeEndPeriod(t);
});
});

#endif

auto now = std::chrono::high_resolution_clock::now();
Expand Down

0 comments on commit ff1e79f

Please sign in to comment.