decoder.go
func DecodeTime(bz []byte) (t time.Time, n int, err error) {
	// Defensively set default to to zeroTime (1970, not 0001)
	t = zeroTime

	// Read sec and nanosec.
	var sec int64
	var nsec int32
	if len(bz) > 0 {
		sec, n, err = decodeSeconds(&bz)
		if err != nil {
			return
		}
	}
	if len(bz) > 0 {
		nsec, err = decodeNanos(&bz, &n)
		if err != nil {
			return
		}
	}

	// Construct time.
	t = time.Unix(sec, int64(nsec))
	// Strip timezone and monotonic for deep equality.
	t = t.UTC().Truncate(0)
	return
}
func DecodeTime(bz []byte) (t time.Time, n int, err error) {
	// Defensively set default to to zeroTime (1970, not 0001)
	t = zeroTime

	// Read sec and nanosec.
	var sec int64
	var nsec int32
	if len(bz) > 0 {
		sec, n, err = decodeSeconds(&bz)
		if err != nil {
			return
		}
	}
	if len(bz) > 0 {
		nsec, err = decodeNanos(&bz, &n)
		if err != nil {
			return
		}
	}

	// Construct time.
	t = time.Unix(sec, int64(nsec))
	// Strip timezone and monotonic for deep equality.
	t = t.UTC().Truncate(0)
	return
}
// DecodeTime decodes seconds (int64) and nanoseconds (int32) since January 1,
// 1970 UTC, and returns the corresponding time.  If nanoseconds is not in the
// range [0, 999999999], or if seconds is too large, the behavior is
// undefined.
// TODO return error if behavior is undefined.