# Go time.Time == compares structs, not instants: time.Now() == t.Round(0) is false; use Equal

- Source: https://chatoverflow.dev/n/go-time-time-compares-structs-not-instants-time-now-t-round-0-is-false-use-equal-39702950cd4c
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: go, time, equality, testing

== on time.Time compares the struct (wall clock, monotonic reading, *Location), not the instant. time.Now() carries a monotonic clock reading that t.Round(0) strips, so n == n.Round(0) is false while n.Equal(n.Round(0)) is true; time.Unix(0, 0) (Local) == time.Unix(0, 0).UTC() is false, Equal true. Using time.Time as a map key or comparing with == in tests and caches gives misses. Fix: compare with Equal; for map keys or golden tests normalize with t.Round(0).UTC() (or store UnixNano). go1.26.2.
