Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected timezone conversion for Attempt "started"/"ended" times #2400

Closed
verstatx opened this issue Feb 11, 2024 · 2 comments
Closed

Unexpected timezone conversion for Attempt "started"/"ended" times #2400

verstatx opened this issue Feb 11, 2024 · 2 comments
Labels
bug Reports unexpected behavior (or for a PR: fixes unexpected behavior).

Comments

@verstatx
Copy link

verstatx commented Feb 11, 2024

A streamer working on a "Best Pace Since" component, which shows a relative timestamp/date, noticed that times loaded from the splits file were undergoing a local->UTC timezone conversion while attempts done with the timer open were not, leading to inconsistencies in the output.

I assume this DateTime.Parse(), which is missing the DateTimeStyles.AssumeUniversal argument and leaves the DateTime.Kind as UnspecifiedLocal, causes the problem:
https://github.com/LiveSplit/LiveSplit/blob/master/LiveSplit/LiveSplit.Core/Model/RunFactories/StandardFormatsRunFactory.cs#L51

I'd open a PR, but I do not have a windows environment set up, and have no good way of testing for regressions at the moment.

@wooferzfg wooferzfg added the bug Reports unexpected behavior (or for a PR: fixes unexpected behavior). label Feb 11, 2024
@wooferzfg
Copy link
Member

The timestamp we're getting back from livesplit-core already have the time zone info as UTC. The issue is that we're not converting to UTC with ToUniversalTime()

@wooferzfg
Copy link
Member

wooferzfg commented Feb 11, 2024

Until the fix for this is released, in the "Best Pace Since" component, you can just call ToUniversalTime() on the AttemptStarted and AttemptEnded timestamps to get them all into UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reports unexpected behavior (or for a PR: fixes unexpected behavior).
Projects
None yet
Development

No branches or pull requests

2 participants