AppendTime appends a time.Time to the slice as a MessagePack extension
(b []byte, t time.Time)
| 314 | |
| 315 | // AppendTime appends a time.Time to the slice as a MessagePack extension |
| 316 | func AppendTime(b []byte, t time.Time) []byte { |
| 317 | o, n := ensure(b, TimeSize) |
| 318 | t = t.UTC() |
| 319 | o[n] = mext8 |
| 320 | o[n+1] = 12 |
| 321 | o[n+2] = TimeExtension |
| 322 | putUnix(o[n+3:], t.Unix(), int32(t.Nanosecond())) |
| 323 | return o |
| 324 | } |
| 325 | |
| 326 | // AppendTimeExt will write t using the official msgpack extension spec. |
| 327 | // https://github.com/msgpack/msgpack/blob/master/spec.md#timestamp-extension-type |
searching dependent graphs…