Constructors ready
Now, At / AtNsec / AtTime (Time.at), UTC (Time.utc / gm), Local (Time.local / mktime), New (fixed UTC offset), plus Parse (Time.parse) and Strptime (Time.strptime).
Ruby's Time class and the time stdlib's parsing extensions in pure Go โ MRI byte-exact, no cgo.
Time
strftime / strptime
Time.parse
iso8601 ยท rfc2822 ยท httpdate
zone shifts
NowFunc seam
MRI byte-exact
100% coverage
6 archesgo-ruby-time is a pure-Go (no cgo) reimplementation of Ruby's Time class and the time standard library's parsing extensions โ the epoch-based instant, distinct from Date, matching MRI's API surface and formatting byte-for-byte. It builds, formats, parses and does arithmetic over instants โ the full strftime directive set, Time.parse and Time.strptime, zone shifts, ordering, and the iso8601 / rfc2822 / httpdate / ctime formatters โ without any Ruby runtime, using Go's time package only for the underlying civil/zone math. The only non-determinism, the wall clock behind Time.now, is isolated behind a single NowFunc seam a test can pin. It is a standalone, reusable module โ the Time backend bound into go-embedded-ruby by rbgo, the same pattern as go-ruby-yaml โ differential-tested against MRI, 100% coverage, CI green across 6 arches and 3 OSes.
Now, At / AtNsec / AtTime (Time.at), UTC (Time.utc / gm), Local (Time.local / mktime), New (fixed UTC offset), plus Parse (Time.parse) and Strptime (Time.strptime).
Year โฆ Sec, USec / NSec / Subsec, WDay / YDay / UTCOffset / Zone / GMT / DST, the weekday predicates, and to_i / to_f / to_r / to_a.
UTCTime (getutc / utc / gmtime), GetLocal (getlocal(offset)) and ToLocal (localtime) โ preserving the instant while changing the observed offset.
Add / Sub by fractional seconds, Diff (Time - Time โ float), Round / Floor / Ceil, plus Cmp (<=>), Before / After, Equal and an Equal-consistent Hash โ all offset-independent.
Strftime (the full C/Ruby directive set: %-/%_ flags, %N/%L sub-second, ISO week %V/%G, %z/%:z/%::z offsets), plus Inspect, ToS, CTime, ISO8601, RFC2822 and HTTPDate โ MRI’s exact bytes.
Every formatter, the full strftime corpus, the numeric accessors, arithmetic, Parse and Strptime cross-checked against the system ruby under TZ=UTC (gated on Ruby โฅ 4.0); 100% coverage, green across 6 arches and 3 OSes.
A faithful pure-Go port of Ruby's `Time`, cgo disabled, so it cross-compiles and embeds anywhere. Validated differentially against the system ruby binary, byte-for-byte. It is a standalone, reusable module extracted from rbgo's internals, and the backend bound by rbgo into the sibling org github.com/go-embedded-ruby.