Repository navigation
Backport 2367 - #2427
Merged
Merged
Backport 2367#2427
Conversation
The start-time/end-time attributes on XCCDF TestResult elements are produced by _get_timestamp(). On glibc the offset was taken from the global `timezone` variable, which holds the standard-time offset and does not account for daylight saving time. The wall-clock fields come from localtime_r() and are DST-correct, so during DST the printed offset was wrong by one hour, making the timestamp denote the wrong instant (e.g. an America/Los_Angeles scan in summer reported -08:00 instead of -07:00). Use struct tm.tm_gmtoff when available; it carries the actual UTC offset in effect at the represented local time, DST included. A new HAVE_STRUCT_TM_TM_GMTOFF CMake feature check guards it, falling back to the timezone global (plus a DST hour) on platforms without tm_gmtoff such as the MSVC runtime. This also drops the FreeBSD-specific branch that previously re-added an hour to deliberately mirror the glibc bug. Fixes OpenSCAP#1972 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The fallback path subtracts 3600 seconds from `timezone`, but the comment described this as "add an hour", which reads as contradicting the code. Reword to explain that `timezone` is seconds west of UTC and DST shifts local time one hour east (closer to UTC), so the westward offset is reduced by 3600 seconds. No behavior change.
|
jan-cerny
approved these changes
Oct 5, 2026
jan-cerny
left a comment
Member
There was a problem hiding this comment.
I have confirmed that the PR is the same as the linked PR and correctly backports the linked PR to the target branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.




Backport #2367