Time is a Lie and How to Deal With It in Ruby
summary
Ruby and Rails specifics: DST makes some days 25 hours (86,400 vs 90,000 seconds) so 24.hours adds seconds while 1.day advances the calendar, months follow month-ends, and time.now/Time.parse use the system zone while time.current and time.zone.parse use app config. TZInfo raises on ambiguous or nonexistent local times; ActiveSupport may pick silently. Postgres timestamptz normalizes to UTC, so store the IANA zone with the instant and compute recurring reminders from stored parameters (zone + local time) when firing.
AI-written summary · about
chapters (10)
- 0:00Introduction to time deception
- 1:38History of time measurement
- 4:50Duration vs calendar time traps
- 8:03Time zones and political decisions
- 10:14Time.now and Time.parse pitfalls
- 12:01Daylight saving time edge cases
- 14:27Serialization and storage loss
- 17:17Equation of time and solar time
- 19:25Building reliable reminders
- 22:35Summary and final thoughts
