code: 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 {
  		// Kdbx v3.1
  		b := make([]byte, 0, len(time.RFC3339))
  		ret = t.AppendFormat(b, time.RFC3339)
  	} else {
  		// Kdbx v4 - Count since year 0
  		total := uint64(0)
  		zero := time.Date(0, 1, 0, 0, 0, 0, 0, time.UTC)
  		temp := t
  		for {
  			diff := temp.Sub(zero)
  			if diff.Seconds() == 0 {
  				break
  			}
  
  			total = total + uint64(diff.Seconds())
  			temp = temp.Add(-diff)
  		}
  		buf := make([]byte, 8)
  		binary.LittleEndian.PutUint64(buf, total)
  		ret = make([]byte, base64.StdEncoding.EncodedLen(len(buf)))
  		base64.StdEncoding.Encode(ret, buf)
  	}
  	return ret, nil
  }
docs: // 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