You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
📣 Announcement: time.Time decoding defaults to UTC in v3
Starting with v3.0.0, when decoding MessagePack Timestamp into Go’s time.Time,
the default Location will be UTC (previously Local). The instant is unchanged.
To keep the old behavior, use SetDecodedTimeAsLocal().
📣 Announcement: time.Time decoding defaults to UTC in v3
TL;DR: Starting with v3.0.0, when decoding MessagePack Timestamp into Go’s time.Time, the default Location will be UTC (previously Local). The instant is unchanged—only the display/location changes. This avoids host-dependent differences and aligns with common distributed systems practice.
What is changing?
Before (v2.x): Decoded time.Time defaults to Local.
After (v3.0.0): Decoded time.Time defaults to UTC.
MessagePack’s Timestamp encodes an instant (epoch seconds + nanoseconds) and does not carry timezone info. Your data’s point in time is the same; only time.Time.Location() differs.
Why?
Eliminate environment-dependent behavior (e.g., different hosts showing different local zones).
Make “UTC by default” the safe, predictable baseline for logs, APIs, and distributed apps.
Who is affected?
Apps that display local time without explicitly converting from UTC.
If your code already normalizes to UTC or explicitly sets a location, you’re likely unaffected.
Keep the old behavior (Local)
If you want the v2 behavior on v3:
msgpack.SetDecodedTimeAsLocal()
Or convert after the fact:
vart time.Time_=msgpack.Unmarshal(data, &t)
t=t.In(time.Local)