CnCNet / xna-cncnet-client

XNA / MonoGame based client for playing classic Command & Conquer games both online and offline with a CnCNet game spawner.
Other
226 stars 87 forks source link

Use 24-hour time format in TopBar to prevent the string from going beyond the border #366

Closed pzhlkj6612 closed 1 year ago

pzhlkj6612 commented 1 year ago

Summary

If the time format settings of the OS contains an AM/PM designator, it will go beyond the right border of the window.

Why

The placeholder of lblTime is "99:99:99":

https://github.com/CnCNet/xna-cncnet-client/blob/624dfccd23011970ed2ce668888fd71132b0a560/DXMainClient/DXGUI/Generic/TopBar.cs#L161-L167

So I think using 24-hour format (HH:mm:ss) is OK.

Comparison

20220911-CnCNet-DXClient-TopBar-time-format

And...

There is a wrong time format string:

https://github.com/CnCNet/xna-cncnet-client/blob/624dfccd23011970ed2ce668888fd71132b0a560/DXMainClient/Domain/Multiplayer/CnCNet/MapSharer.cs#L418-L422

We should use "HH:mm:ss" instead of "hh:mm:ss" because "hh" is a number from 01 to 12. Since the code is commented out and not relevant to this PR, I didn't modify it.

See also: The "hh" custom format specifier § Custom date and time format strings | Microsoft Docs

github-actions[bot] commented 1 year ago

Nightly build for this pull request: