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
Unmarshal a byte array that was generated by marshaling an empty time struct
If the unmarshal will receive an interface, this interface will eventually contain an empty time struct but with LMT timezone (that doesnt work properly in many cases)
If the unmarshal will receive a time struct, this will work properly
Expected Behavior
empty time object in utc timezone
Current Behavior
empty time object in LMT timezone
Possible Solution
add tm.isZero case to the flow of unmarshaling from interface
It does exists if a typed time struct is provided
Steps to Reproduce
See the following unit test:
func TestEmptyTimeMarshalWithInterface(t *testing.T) {
a := time.Time{}
b, err := msgpack.Marshal(a)
if err != nil {
t.Fatal(err)
}
var out interface{}
err = msgpack.Unmarshal(b, &out)
if err != nil {
t.Fatal(err)
}
name, _ := out.(time.Time).Zone()
if name != "UTC" {
t.Fatal("Got wrong timezone")
}
var out2 time.Time
err = msgpack.Unmarshal(b, &out2)
if err != nil {
t.Fatal(err)
}
name, _ = out2.Zone()
if name != "UTC" {
t.Fatal("Got wrong timezone")
}
}
The text was updated successfully, but these errors were encountered:
Unmarshal a byte array that was generated by marshaling an empty time struct
If the unmarshal will receive an interface, this interface will eventually contain an empty time struct but with LMT timezone (that doesnt work properly in many cases)
If the unmarshal will receive a time struct, this will work properly
Expected Behavior
empty time object in utc timezone
Current Behavior
empty time object in LMT timezone
Possible Solution
add tm.isZero case to the flow of unmarshaling from interface
It does exists if a typed time struct is provided
Steps to Reproduce
See the following unit test:
The text was updated successfully, but these errors were encountered: