Skip to content

Fix #2782, make TIME print independent of time_t width - #2793

Open
sylvesterkaczmarek wants to merge 1 commit into
nasa:devfrom
sylvesterkaczmarek:fix-2782-time-print-32bit-final
Open

sylvesterkaczmarek wants to merge 1 commit into
nasa:devfrom
sylvesterkaczmarek:fix-2782-time-print-32bit-final

Conversation

@sylvesterkaczmarek

@sylvesterkaczmarek sylvesterkaczmarek commented Aug 13, 2026 •

Copy link
Copy Markdown

Checklist (Please check before submitting)

Describe the contribution

Fix #2782.

Make CFE_TIME_Print() independent of the host C library's time_t width.

The previous implementation converted cFE seconds to time_t and called gmtime_r(). On platforms with a 32-bit time_t, timestamps beyond the signed 32-bit Unix-time range could wrap and produce an incorrect calendar date.

This change converts the cFE timestamp directly into the struct tm fields required by the existing %Y-%j-%H:%M:%S output format using 64-bit arithmetic and Gregorian leap-year rules.

The public API and printed format remain unchanged.

Regression coverage also exercises the maximum 32-bit cFE seconds value and crosses the year-2100 non-leap-century boundary.

Testing performed

  1. Added focused TIME unit coverage for the maximum cFE seconds value.
  2. Verified the existing timestamps continue to produce their expected output.
  3. Fork-side Code Coverage Analysis passed.
  4. Upstream NASA GitHub Actions currently require repository authorization for this fork-originated PR, so no upstream CI success is being claimed yet.

Expected behavior changes

  • API Change: none.
  • Behavior Change: CFE_TIME_Print() no longer depends on the host time_t range for supported cFE timestamps.
  • 32-bit and 64-bit builds produce the same calendar representation for timestamps beyond the 2038 Unix-time boundary.

System(s) tested on

  • Repository baseline: cFE dev.
  • Validation: focused TIME regression coverage and fork GitHub Actions.

Additional context

Issue #2782 reports the existing rollover in a 32-bit TIME build. This change fixes the underlying flight-software behavior rather than making the test accept the wrapped date.

Third party code

None.

Contributor Info - All information REQUIRED for consideration of pull request

Sylvester Kaczmarek, Personal

Validation update on 7 October 2026

Current validated commit 2bbd55873984.

The refreshed exact source tree passed the repository's complete non-EDS Code Coverage Analysis workflow on the contributor fork: https://github.com/sylvesterkaczmarek/cFE/actions/runs/37638566914. The job used the normal cFS build container and upstream setup-cfe action, built the configured core modules, ran their CTest suites, and passed coverage enforcement without modifying workflow rules. This verifies the default native Linux unit-test/coverage configuration; it does not claim every target, EDS mode or 32-bit ABI was tested. The validation branch and upstream PR branch point to the same verified commit. No dependency or build-policy changes are included.

The complete upstream workflow result is not claimed from local checks. Fresh fork workflows may require maintainer approval.

@sylvesterkaczmarek sylvesterkaczmarek changed the title Fix 2782 time print 32bit final Fix #2782, make TIME print independent of time_t width Aug 13, 2026
@sylvesterkaczmarek
sylvesterkaczmarek marked this pull request as ready for review August 16, 2026 09:40
@sylvesterkaczmarek

Copy link
Copy Markdown
Author

This remains current and mergeable, and the NASA checks are green. Could a maintainer review when convenient?

@dzbaker

dzbaker commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Thank you @sylvesterkaczmarek for this contribution! I have added this to our team's review list. We have a fairly small team maintaining cFS and are gradually working through our backlog of submissions.

Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
@sylvesterkaczmarek
sylvesterkaczmarek force-pushed the fix-2782-time-print-32bit-final branch from b0a1a04 to 2bbd558 Compare October 7, 2026 14:45
@sylvesterkaczmarek

Copy link
Copy Markdown
Author

Updated validation is recorded in the PR description for 2bbd55873984. The branch is refreshed onto the checked live base. Could a maintainer review this head and approve any waiting workflows?

@sylvesterkaczmarek

Copy link
Copy Markdown
Author

Is there anything else you need for the time_t-width fix while it is in the review queue?

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.

cFE Time Print Inconsistency with 32-bit Builds

2 participants