#3350 closed defect (fixed)
[PATCH] Time is not localized but in UTC
Reported by: | elexis | Owned by: | elexis |
---|---|---|---|
Priority: | Must Have | Milestone: | Alpha 21 |
Component: | UI & Simulation | Keywords: | patch |
Cc: | Patch: |
Description
Currently the FormatMillisecondsIntoDateString
function always returns the time in UTC (or GMT) and doesn't adapt to the local timezone (no matter how you define your language or country in the settings).
You can observe this issue in the lobby (chat timestamps) and in the savegame-loading-menu. The visual-replay-menu #3258 will also be affected.
Refs #1530 (outdated)
Attachments (3)
Change History (15)
comment:1 by , 9 years ago
comment:3 by , 8 years ago
comment:5 by , 8 years ago
The fix above shows that we might face problems when using directly std::time
and related functions on different platforms.
We should implement a CTime
class for the engine that would allow us to fix a number of those date-time problems in a consistent and easily maintainable way.
comment:6 by , 8 years ago
Keywords: | patch rfc added |
---|---|
Milestone: | Backlog → Alpha 21 |
Summary: | Time is not localized but in UTC → [PATCH] Time is not localized but in UTC |
by , 8 years ago
Attachment: | lobby_local_time.patch added |
---|
localize lobby chat timestamp (Based on r17929
by , 8 years ago
Attachment: | lobby_local_time_v2.patch added |
---|
More general approach, fixing (hopefully) all places where non-localized time was used.
follow-up: 9 comment:8 by , 8 years ago
Component: | Core engine → UI & Simulation |
---|---|
Priority: | Should Have → Must Have |
Perhaps the C++ function itself should be changed. Since it's a file about localization, it would make sense to add the ability to localize a timestamp to that place. Should get the approach confirmed by Itms.
comment:9 by , 8 years ago
Replying to elexis:
Perhaps the C++ function itself should be changed. Since it's a file about localization, it would make sense to add the ability to localize a timestamp to that place. Should get the approach confirmed by Itms.
comment:11 by , 8 years ago
Keywords: | rfc removed |
---|
Thanks for the patch!
See also http://icu-project.org/apiref/icu4c/classicu_1_1TimeZone.html
LocalizeDateTime
which is used for the build timestamp returns the formatted time in the current local timezone. The ingame timesamp has always been printed in the current timezone by using a JS function.
Also note r16037 and #2938, so the proper fix would be to use actual dates.