Skip to content

Initialize logging explicitly and read the clock through std::chrono - #153

Draft
gunnarbeutner wants to merge 2 commits into
OpenTS-Developers:mainfrom
gunnarbeutner:explicit-logging-init
Draft

Initialize logging explicitly and read the clock through std::chrono#153
gunnarbeutner wants to merge 2 commits into
OpenTS-Developers:mainfrom
gunnarbeutner:explicit-logging-init

Conversation

@gunnarbeutner

@gunnarbeutner gunnarbeutner commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Initialize logging explicitly instead of on the first message. Debug_Init takes argc and argv from WinMain, which already built them. That also drops a second command line parse. Messages before the call still reach the
debugger and console.

Read the millisecond clock through std::chrono. The timer then needs no initialization at all: steady_clock replaces the cycle counter and the multimedia timer fallback, so the class holds no state and logs nothing before
main. Call sites which require the current time now read System_Milliseconds(), which counts from the first reading rather than machine boot; every one of them compares readings, so the origin is not needed anyway. timeGetTime, GetTickCount, timeBeginPeriod and timeEndPeriod have no callers left.

This also fixes an inverted condition: timeEndPeriod was called exactly when timeBeginPeriod had not been, and skipped when it had.

@github-actions

Copy link
Copy Markdown

Development builds of 67628bf:

The links work without a GitHub account. Artifacts expire after 90 days, and this comment follows the latest successful build.

@gunnarbeutner
gunnarbeutner marked this pull request as draft September 10, 2026 18:14
@gunnarbeutner gunnarbeutner changed the title Initialize logging and the millisecond timer explicitly Initialize logging explicitly and read the clock through std::chrono Sep 10, 2026
@gunnarbeutner
gunnarbeutner marked this pull request as ready for review September 10, 2026 18:59
@gunnarbeutner
gunnarbeutner marked this pull request as draft September 10, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant