Codefix: [CMake] use the UTC0 date for our ISODATE #12470
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation / Problem
When doing benchmarks on OpenTTD, I asked git: give me the last commit of 2023-12-31, and it told me: sure, that is f56a2d0. But after building OpenTTD it told me it was based on a commit in 2024-01-01.
This confused me, and this PR addresses that issue.
Description
Turns out, we use the TZ of the commit, instead of UTC, when determining the date we show in our
_openttd_revision
. This is because git is very unclear in what it does when/what/where when it comes to timezones.But with this fix, we force the TZ to be UTC, and to output the date in our local timezone, as an ISO date. This is what we assumed
%ci
would do, but clearly doesn't.Limitations
In theory this could mean we served a nightly build on date X, but has an internal reference of being on date X-1 or X+1. But given most of us work in EU times, this is not all that likely. But in theory it was possible!
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.