func EncodeTime(w io.Writer, t time.Time) (err error) {
	s := t.Unix()
	// TODO: We are hand-encoding a struct until MarshalAmino/UnmarshalAmino is supported.
	// skip if default/zero value:
	if s != 0 {
		if s < minSeconds || s >= maxSeconds {
			return InvalidTimeErr(fmt.Sprintf("seconds have to be >= %d and < %d, got: %d",
				minSeconds, maxSeconds, s))
		}
		err = encodeFieldNumberAndTyp3(w, 1, Typ3_Varint)
		if err != nil {
			return
		}
		err = EncodeUvarint(w, uint64(s))
		if err != nil {
			return
		}
	}
	ns := int32(t.Nanosecond()) // this int64 -> int32 cast is safe (nanos are in [0, 999999999])
	// skip if default/zero value:
	if ns != 0 {
		// do not encode if nanos exceed allowed interval
		if ns < 0 || ns > maxNanos {
			// we could as well panic here:
			// time.Time.Nanosecond() guarantees nanos to be in [0, 999,999,999]
			return InvalidTimeErr(fmt.Sprintf("nanoseconds have to be >= 0 and <= %v, got: %d",
				maxNanos, s))
		}
		err = encodeFieldNumberAndTyp3(w, 2, Typ3_Varint)
		if err != nil {
			return
		}
		err = EncodeUvarint(w, uint64(ns))
		if err != nil {
			return
		}
	}

	return
}
func EncodeTime(w io.Writer, t time.Time) (err error) {
	s := t.Unix()
	
	
	if s != 0 {
		if s < minSeconds || s >= maxSeconds {
			return InvalidTimeErr(fmt.Sprintf("seconds have to be >= %d and < %d, got: %d",
				minSeconds, maxSeconds, s))
		}
		err = encodeFieldNumberAndTyp3(w, 1, Typ3_Varint)
		if err != nil {
			return
		}
		err = EncodeUvarint(w, uint64(s))
		if err != nil {
			return
		}
	}
	ns := int32(t.Nanosecond()) 
	
	if ns != 0 {
		
		if ns < 0 || ns > maxNanos {
			
			
			return InvalidTimeErr(fmt.Sprintf("nanoseconds have to be >= 0 and <= %v, got: %d",
				maxNanos, s))
		}
		err = encodeFieldNumberAndTyp3(w, 2, Typ3_Varint)
		if err != nil {
			return
		}
		err = EncodeUvarint(w, uint64(ns))
		if err != nil {
			return
		}
	}

	return
}
func EncodeTime ( w io . Writer , t time . Time ) ( err error ) { s := t . Unix ( ) // TODO: We are hand-encoding a struct until MarshalAmino/UnmarshalAmino is supported. // skip if default/zero value: if s != 0 { if s < minSeconds || s >= maxSeconds { return InvalidTimeErr ( fmt . Sprintf ( " " , minSeconds , maxSeconds , s ) ) } err = encodeFieldNumberAndTyp3 ( w , 1 , Typ3_Varint ) if err != nil { return } err = EncodeUvarint ( w , uint64 ( s ) ) if err != nil { return } } ns := int32 ( t . Nanosecond ( ) ) // this int64 -> int32 cast is safe (nanos are in [0, 999999999]) // skip if default/zero value: if ns != 0 { // do not encode if nanos exceed allowed interval if ns < 0 || ns > maxNanos { // we could as well panic here: // time.Time.Nanosecond() guarantees nanos to be in [0, 999,999,999] return InvalidTimeErr ( fmt . Sprintf ( " " , maxNanos , s ) ) } err = encodeFieldNumberAndTyp3 ( w , 2 , Typ3_Varint ) if err != nil { return } err = EncodeUvarint ( w , uint64 ( ns ) ) if err != nil { return } } return }
// EncodeTime writes the number of seconds (int64) and nanoseconds (int32),
// with millisecond resolution since January 1, 1970 UTC to the Writer as an
// UInt64.
// Milliseconds are used to ease compatibility with Javascript,
// which does not support finer resolution.
EncodeTime writes the number of seconds ( int64 ) and nanoseconds ( int32 ) with millisecond resolution since January 1 1970 UTC to the Writer as an UInt64 . Milliseconds are used to ease compatibility with Javascript which does not support finer resolution .