Skip to content

vms-3dd: RMS XAB dates are real VMS binary time, not raw Unix time_t - #442

Merged
baron-3dl merged 1 commit into
mainfrom
vms-3dd-xab-vms-time
Aug 13, 2026
Merged

baron-3dl merged 1 commit into
mainfrom
vms-3dd-xab-vms-time

Conversation

@baron-3dl

Copy link
Copy Markdown
Contributor

Problem

rms_impl_display() (src/vmsrms/rms_core.c) stuffed raw Unix time_t (seconds since 1970) straight into xab$q_cdt / xab$q_rdt. VMS defines those fields as 100-nanosecond intervals since the base date 17-NOV-1858 (VSI OpenVMS Programming Concepts Manual, Vol. I, "System Time Format"). A raw time_t (~1.6e9) read as that quadword decodes to a few minutes past 1858 — roughly 112 years off and in the wrong units. DIRECTORY/DATE, $ASCTIM, and any XABDAT reader got garbage dates.

Draper faithfulness register Tier 1 item.

Fix

Convert st_ctime / st_mtime through the existing RTL converter lib$cvt_vectim (src/libvms/rtl/lib_datetime.c), which owns the documented VMS_EPOCH_OFFSET constant.

  • No new magic constant, no duplicated conversion arithmetic.
  • No new cross-image symbol: lib$cvt_vectim is already auto-exported by LIBVMS$SHR's symbol vector; the added libc calls gmtime_r/timegm are already in the DECC$SHR vector (mk_decc_shr.sh).
  • gmtime_r breaks the absolute Unix instant into its UTC calendar fields; lib$cvt_vectim's timegm() inverts gmtime() exactly, so the same wall-clock instant round-trips.

Test

test_xab_dates in tests/vmsrms/test_vmsrms.c:

  • pins a known revision instant (15-JUN-2021 12:00:00 UTC) via utimensat on the FAB's resolved on-disk path,
  • $DISPLAYs the XABDAT,
  • asserts the quadword is a real post-1970 VMS binary time (> VMS_EPOCH_OFFSET) — this alone catches the old raw-time_t bug,
  • decodes it back and asserts it round-trips to the exact instant,
  • asserts $ASCTIM renders 15-JUN-2021 12:00:00.00.

ctest -R vmsrms_unit exits 0, all assertions pass. $ASCTIM observed output: 15-JUN-2021 12:00:00.00.

Refs vms-3dd.

🤖 Generated with Claude Code

rms_impl_display() stuffed raw Unix time_t (seconds since 1970) straight
into xab$q_cdt/xab$q_rdt, which VMS defines as 100-nanosecond intervals
since the base date 17-NOV-1858 (VSI OpenVMS Programming Concepts Manual,
Vol. I, "System Time Format"). A raw time_t read as that quadword decodes
to a few minutes past 1858 — ~112 years off and in the wrong units, so
DIRECTORY/DATE, $ASCTIM and any XABDAT reader got garbage dates.

Convert st_ctime/st_mtime through the existing RTL converter lib$cvt_vectim
(src/libvms/rtl/lib_datetime.c), which owns the documented VMS_EPOCH_OFFSET
constant — no new magic constant, no duplicated conversion, no new
cross-image symbol. gmtime_r breaks the absolute Unix instant into its UTC
calendar fields; lib$cvt_vectim's timegm() inverts gmtime() exactly, so the
same wall-clock instant round-trips.

Test: test_xab_dates in tests/vmsrms sets a known revision instant
(15-JUN-2021 12:00:00 UTC) via utimensat, $DISPLAYs the XABDAT, asserts the
quadword is a real post-1970 VMS time (catches the old raw-time_t bug),
round-trips to the exact instant, and that $ASCTIM renders
"15-JUN-2021 12:00:00.00".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@baron-3dl
baron-3dl merged commit b10d6dd into main Aug 13, 2026
61 checks passed
baron-3dl added a commit that referenced this pull request Aug 13, 2026
#445)

Bump OVMX_PRODUCT_VERSION V0.4 → V0.4-1. 24 PRs / 32 commits since V0.4,
packed across dimensions (point release toward the 0.5 milestone):

  self-host (R7)  #409 lib$tparse · #411 CLI$ compiled-CLD · #413 sys$setddir
                  #414 lib$get_foreign · #415 sys$filescan (RTL foundation)
                  #418 parse_tables.mar→C (spine #2) · #429 LIBRARIAN.EXE+.OLB (spine #3)
                  #435 shareable-vector freeze (GSMATCH stability)
  authenticity    #421 veracity rubric (Q1 oracle-source/Q2 real-inject) · #424 30 oracle-pinned constants
                  #433 rmsdef.h 74 fabricated RMS codes → oracle
  UX/DCL/RMS      #422 SHOW CLUSTER real membership · #441 DCL per-@-level local scope
                  #442 RMS XAB dates → VMS 1858-epoch quadword
  networking      #419 virtio NIC (user-mode default + opt-in tap/bridge)
  docs            #423 clustering release train
  + swept: other threads' merged work on main since V0.4

Clustering config-authoring UX (vms-098) + its public-manual grounding gate
remain 0.5 (minor) deliverables — not triggered by this point cut.

Co-authored-by: alice <alice@workspace.local>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant