Skip to content

Use system_clock for current wall-clock time#234

Closed
baxlek wants to merge 1 commit into
encounter:mainfrom
baxlek:main
Closed

Use system_clock for current wall-clock time#234
baxlek wants to merge 1 commit into
encounter:mainfrom
baxlek:main

Conversation

@baxlek

@baxlek baxlek commented Jun 23, 2026

Copy link
Copy Markdown

Replaced steady_clock with system_clock to get current time. Changes made using Claude code. Could be absolute garbage. Feel free to trash this PR if necessary.

Should close issue #232.

Replaced steady_clock with system_clock to get current time.
@baxlek

baxlek commented Jun 25, 2026

Copy link
Copy Markdown
Author

I obviously don't know what I'm doing. The second commit was supposed to only update my fork of aurora.

Fixed it?

@baxlek

baxlek commented Jun 25, 2026

Copy link
Copy Markdown
Author

Looks like this issue (or something similar) was already explored in PR #61. I was afraid this might break other stuff.
Or it might not affect anything at all. IDK what all "wall-clock" is used for.

@baxlek

baxlek commented Jun 26, 2026

Copy link
Copy Markdown
Author

So I had a bit of an epiphany last night. One that would essentially make this PR irrelevant. AFAIK, the only instance where time is shown to the player is when saving or on the file select screen. Using chrono::system_clock::now() there instead of OSGetTime() used to get the time would circumvent the sleep mode desync bug while still being able to keep the steady_clock running in the background. Any instance going forward that isn't linked to actual game logic should probably use this function to get actual device time. LMK if this solution would be preferred and I'll close this PR.

@encounter

Copy link
Copy Markdown
Owner

My thought is to provide an OSGetSystemTime() that uses system_clock and update appropriate places in Dusklight to use it, so that OSGetTime can remain a steady clock for timing purposes

@baxlek

baxlek commented Jun 28, 2026

Copy link
Copy Markdown
Author

Like I thought. Alright, closing.

@baxlek baxlek closed this Jun 28, 2026
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.

2 participants