Skip to content

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

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

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

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown

Development builds of 5274ed9:

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
@gunnarbeutner
gunnarbeutner marked this pull request as ready for review September 11, 2026 06:59
@ZivDero ZivDero added the no change record Engine change needs no manual change record label Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no change record Engine change needs no manual change record

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants