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

Change date and time representation to ISO 8601 #343

Merged
merged 1 commit into from May 9, 2019

Conversation

@Forgon2100
Copy link
Contributor

commented Apr 29, 2019

The notation used to represent date and time varies around the world,
but is standardized by ISO 8601:

  • dates are written in the format "YYYY-MM-DD", e.g. "2018-12-24"
  • times are written in the format "HH:MM:SS", e.g. "23:59:59"

Consistently using this format avoids the programming effort required
to support all the different conventions used by the languages we offer.

The build date is generated with the macro __DATE__,
which follows the American convention to print the month name ahead of
the day of the month. Via getCompileDate() it is converted to ISO 8601.
This change is observable

  • on the right margin of main menu screens
  • when starting the game with the commandline option '--version'
  • when using the cheats "build info" and "timedemo".
    They show the date ahead of the time, no longer reversing their order.

Savegame screens show file modification time on button tooltips.
Their strftime() format is "%F %T", locale-independent unlike "%x %X".

Debug output uses the 24-hour clock instead of the 12-hour-clock:

main    |18:53:28: [realmain:1219] initializing

The attached ZIP file contains

  • screenshots showing savegame buttons tooltips (old and new)
  • a savegame and a shell script used to generate them

iso_8601_documentation.zip

@Forgon2100 Forgon2100 force-pushed the Forgon2100:iso_8601 branch from 8663ce6 to 026c891 Apr 29, 2019

Forgon2100 added a commit to Forgon2100/warzone2100 that referenced this pull request Apr 29, 2019
Change date and time representation to ISO 8601
* new function getCompileDate() converts macro __DATE__ to ISO 8601
* do not use US date format in version string
* write date ahead of time, rather than in reverse order, in messages
  for cheats "build info" and "timedemo"
* use 24-hour clock instead of 12-hour clock for debug messages
* locale-independent tooltips of buttons that show savegame information

Fixes Warzone2100#343
Change date and time representation to ISO 8601
* new function getCompileDate() converts macro __DATE__ to ISO 8601
* do not use US date format in version string
* write date ahead of time, rather than in reverse order, in messages
  for cheats "build info" and "timedemo"
* use 24-hour clock instead of 12-hour clock for debug messages
* locale-independent tooltips of buttons that show savegame information

Fixes #343

@Forgon2100 Forgon2100 force-pushed the Forgon2100:iso_8601 branch from 026c891 to bdec4b6 Apr 30, 2019

@KJeff01 KJeff01 added this to the 3.3.0_beta2 milestone May 9, 2019

@KJeff01

This comment has been minimized.

Copy link
Contributor

commented May 9, 2019

Works for me.

@KJeff01 KJeff01 merged commit 224a92a into Warzone2100:master May 9, 2019

6 of 8 checks passed

LGTM analysis: JavaScript No code changes detected
Details
LGTM analysis: Python No code changes detected
Details
LGTM analysis: C/C++ No new or fixed alerts
Details
WIP Ready for review
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
freebsd_build FreeBSD:freebsd-11-2-release-amd64 Task Summary
Details
freebsd_build FreeBSD:freebsd-12-0-release-amd64 Task Summary
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.