Skip to content

Backport #2301#2306

Closed
Mab879 wants to merge 1 commit intoOpenSCAP:maint-1.3from
Mab879:backport_2301
Closed

Backport #2301#2306
Mab879 wants to merge 1 commit intoOpenSCAP:maint-1.3from
Mab879:backport_2301

Conversation

@Mab879
Copy link
Copy Markdown
Member

@Mab879 Mab879 commented Feb 6, 2026

No description provided.

@Mab879
Copy link
Copy Markdown
Member Author

Mab879 commented Feb 10, 2026

Seems localtime_s is POSIX, not C standard. I will need to review.

@Mab879 Mab879 marked this pull request as draft February 10, 2026 01:36
@jan-cerny jan-cerny self-assigned this Mar 31, 2026
@jan-cerny
Copy link
Copy Markdown
Member

Windows has localtime_s https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/localtime-s-localtime32-s-localtime64-s?view=msvc-170 , Unix has localtime_r. Ideally, you would define a wrapper function like oscap_localtime which would contain preprocessor macros (#ifdef WINDOWS) that would choose one of these functions based at compile time according to target platform. Then, you would use the oscap_localtime everywhere where localtime is called.

I think it isn't probably worth the effort and we can live with having the fix only in the main branch where we don't need to solve Windows.

@Mab879
Copy link
Copy Markdown
Member Author

Mab879 commented Mar 31, 2026

Windows has localtime_s https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/localtime-s-localtime32-s-localtime64-s?view=msvc-170 , Unix has localtime_r. Ideally, you would define a wrapper function like oscap_localtime which would contain preprocessor macros (#ifdef WINDOWS) that would choose one of these functions based at compile time according to target platform. Then, you would use the oscap_localtime everywhere where localtime is called.

I think it isn't probably worth the effort and we can live with having the fix only in the main branch where we don't need to solve Windows.

Agreed, closing.

@Mab879 Mab879 closed this Mar 31, 2026
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.

2 participants