🌐 AI搜索 & 代理 主页
Skip to content

Releases: shamaton/msgpack

v2.4.0

15 Oct 15:11
2dcdf8e

Choose a tag to compare

Highlights

  • New global switches to control the timezone used when decoding MessagePack Timestamp into Go’s time.Time.
  • No breaking changes in v2.4.0. The default behavior remains Local.
  • Heads-up for v3: default decoded time.Time will change to UTC (instant unchanged).

Added

  • msgpack.SetDecodedTimeAsUTC() — forces decoded time.Time to use UTC.
  • msgpack.SetDecodedTimeAsLocal() — forces decoded time.Time to use Local (mirrors current default in v2.x).

These functions allow you to preview and standardize your runtime behavior before upgrading to v3.

Why this matters

MessagePack’s Timestamp represents an instant (epoch seconds + nanoseconds) and does not carry timezone info. Historically, decoding to Local could lead to environment-dependent differences across hosts. Many distributed systems and APIs prefer UTC for predictability.

Usage

// Opt in to UTC decoding on v2.x (recommended for distributed systems/APIs)
msgpack.SetDecodedTimeAsUTC()

// Restore/keep Local decoding explicitly
msgpack.SetDecodedTimeAsLocal()

Note: v2.4.0 still defaults to Local unless you call SetDecodedTimeAsUTC().

What’s next (v3 heads-up)

In v3.0.0, the default decoded time.Time location will change from Local to UTC.
The encoded/decoded instant is unchanged; only time.Time.Location() differs.
If you rely on local display, you’ll be able to call msgpack.SetDecodedTimeAsLocal() to keep the old behavior.

Migration tips

  • If your UI expects local time, call msgpack.SetDecodedTimeAsLocal() at startup.
  • For logs/APIs/DBs, consider standardizing on UTC now via msgpack.SetDecodedTimeAsUTC() to smooth the v3 upgrade.
  • Tests that assert string forms of time.Time may need to normalize to UTC or set the desired location explicitly.

Links

Full Changelog: v2.3.1...v2.4.0

v2.3.1

28 Aug 14:09
9d7a78e

Choose a tag to compare

What's Changed

Full Changelog: v2.3.0...v2.3.1

v2.3.0

10 Aug 07:21

Choose a tag to compare

What's Changed

Full Changelog: v2.2.3...v2.3.0

v2.2.3

15 Mar 13:12
d00aa7a

Choose a tag to compare

What's Changed

Full Changelog: v2.2.2...v2.2.3

v2.2.2

08 Sep 01:57
5965c7f

Choose a tag to compare

What's Changed

Full Changelog: v2.2.1...v2.2.2

v2.2.1

26 Aug 22:37
ead6a6b

Choose a tag to compare

What's Changed

fixed in 2226b13 , fa57eea , 7155d37

Full Changelog: v2.2.0...v2.2.1

v2.2.0

17 Mar 13:40
d1c8383

Choose a tag to compare

What's Changed

Full Changelog: v2.1.1...v2.2.0

v2.1.1

21 Oct 14:14
01ee57d

Choose a tag to compare

Merge pull request #32 from shamaton/case_crash

Return error when strange data is received

v2.1.0

05 Aug 03:53
a5e4750

Choose a tag to compare

Merge pull request #27 from shamaton/not_using_unsafe

Not using unsafe

v2.0.2

04 Aug 14:24

Choose a tag to compare

check nil data