// MarshalText marshals time into an RFC3339 compliant value in UTC (Kdbx v3.1)
// On Kdbx v4 it calculates the timestamp subtracting seconds from the time date and encode it with base64
MarshalText marshals time into an RFC3339 compliant value in UTC (Kdbx v3.1)
On Kdbx v4 it calculates the timestamp subtracting seconds from the time date and encode it with base64
// MarshalText marshals time into an RFC3339 compliant value in UTC ( Kdbx v3 . 1 ) // On Kdbx v4 it calculates the timestamp subtracting seconds from the time date and encode it with base64
func (tw TimeWrapper) MarshalText() ([]byte, error) {
	t := time.Time(tw.Time).In(time.UTC)
	if y := t.Year(); y < 0 || y >= 10000 {
		return nil, ErrYearOutsideOfRange
	}
	var ret []byte
	if tw.Formatted {
		b := make([]byte, 0, len(time.RFC3339))
		ret = t.AppendFormat(b, time.RFC3339)
	} else {
		total := t.Unix() - zeroUnixOffset
		buf := make([]byte, 8)
		binary.LittleEndian.PutUint64(buf, uint64(total))
		ret = make([]byte, base64.StdEncoding.EncodedLen(len(buf)))
		base64.StdEncoding.Encode(ret, buf)
	}
	return ret, nil
}
func ( tw TimeWrapper ) MarshalText ( ) ( [ ] byte , error ) { t := time . Time ( tw . Time ) . In ( time . UTC ) if y := t . Year ( ) ; y < 0 || y >= 10000 { return nil , ErrYearOutsideOfRange } var ret [ ] byte if tw . Formatted { b := make ( [ ] byte , 0 , len ( time . RFC3339 ) ) ret = t . AppendFormat ( b , time . RFC3339 ) } else { total := t . Unix ( ) - zeroUnixOffset buf := make ( [ ] byte , 8 ) binary . LittleEndian . PutUint64 ( buf , uint64 ( total ) ) ret = make ( [ ] byte , base64 . StdEncoding . EncodedLen ( len ( buf ) ) ) base64 . StdEncoding . Encode ( ret , buf ) } return ret , nil }
MarshalText marshals time into an RFC3339 compliant value in UTC (Kdbx v3.1)
On Kdbx v4 it calculates the timestamp subtracting seconds from the time date and encode it with base64
MarshalText marshals time into an RFC3339 compliant value in UTC ( Kdbx v3 . 1 ) On Kdbx v4 it calculates the timestamp subtracting seconds from the time date and encode it with base64
// Kdbx v3.1 // Kdbx v4 - Count since year 1