Skip to main content

Module exact

Module exact 

Source
Expand description

ExactBrightDate — bit-exact picosecond-precision time.

Whereas BrightDate uses f64 decimal days for ergonomic math and astronomy, ExactBrightDate uses a signed i128 count of picoseconds since J2000.0 to provide bit-for-bit round-trip fidelity with Unix milliseconds, Unix seconds, and other integer-based representations.

§When to use which

Use caseChoose
Application timestamps, logs, scheduling, displayBrightDate
Astronomy, physics, fractional mathBrightDate
Distributed systems, GPS, interplanetary timingBrightInstant
Blockchain consensus on raw Unix-ms valuesExactBrightDate
Long-term archival that must survive bit-for-bitExactBrightDate
Sub-picosecond precision at any magnitudeExactBrightDate

§Precision

  • Internal unit: picoseconds (1e-12 s).
  • Range: i128 covers ±~1.7e38 ps ≈ ±5.4e18 years. Comfortably beyond the age of the universe in either direction.
  • Resolution: 1 picosecond, exactly, everywhere.

§Algebraic laws

For any integer unix_ms in i64:

ExactBrightDate::from_unix_ms(unix_ms).to_unix_ms() == unix_ms       (bit-exact)

For any a: ExactBrightDate and n: i128 nanoseconds:

a.add_nanoseconds(n).subtract_nanoseconds(n) == a                    (bit-exact)

ExactBrightDate is immutable. All operations return new instances.

Structs§

ExactBrightDate
An immutable, bit-exact time value stored as picoseconds since J2000.0.

Constants§

J2000_UNIX_MS_I64
J2000.0 expressed as Unix milliseconds — the exact i64 form of crate::constants::J2000_UTC_UNIX_MS.
J2000_UNIX_PS
J2000.0 expressed as Unix picoseconds (UTC label).
PS_PER_DAY
Picoseconds per SI day (86 400 s).
PS_PER_MS
Picoseconds per millisecond.
PS_PER_NS
Picoseconds per nanosecond.
PS_PER_S
Picoseconds per SI second.
PS_PER_US
Picoseconds per microsecond.