Skip to content

Backport 2367 - #2427

Merged
jan-cerny merged 2 commits into
OpenSCAP:maint-1.3from
Mab879:2367_maint_1_3
Oct 5, 2026
Merged

jan-cerny merged 2 commits into
OpenSCAP:maint-1.3from
Mab879:2367_maint_1_3

Conversation

@Mab879

@Mab879 Mab879 commented Oct 4, 2026

Copy link
Copy Markdown
Member

Backport #2367

eran132 and others added 2 commits October 4, 2026 18:06
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.
@Mab879 Mab879 added this to the 1.3.15 milestone Oct 4, 2026
@sonarqubecloud

sonarqubecloud Bot commented Oct 4, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
D Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@jan-cerny jan-cerny self-assigned this Oct 5, 2026

@jan-cerny jan-cerny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have confirmed that the PR is the same as the linked PR and correctly backports the linked PR to the target branch.

@jan-cerny
jan-cerny merged commit b0008ad into OpenSCAP:maint-1.3 Oct 5, 2026
10 of 11 checks passed
@Mab879
Mab879 deleted the 2367_maint_1_3 branch October 5, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants