MCPcopy
hub / github.com/uber-go/zap / EpochTimeEncoder

Function EpochTimeEncoder

zapcore/encoder.go:103–107  ·  view source on GitHub ↗

EpochTimeEncoder serializes a time.Time to a floating-point number of seconds since the Unix epoch.

(t time.Time, enc PrimitiveArrayEncoder)

Source from the content-addressed store, hash-verified

101// EpochTimeEncoder serializes a time.Time to a floating-point number of seconds
102// since the Unix epoch.
103func EpochTimeEncoder(t time.Time, enc PrimitiveArrayEncoder) {
104 nanos := t.UnixNano()
105 sec := float64(nanos) / float64(time.Second)
106 enc.AppendFloat64(sec)
107}
108
109// EpochMillisTimeEncoder serializes a time.Time to a floating-point number of
110// milliseconds since the Unix epoch.

Callers

nothing calls this directly

Calls 1

AppendFloat64Method · 0.65

Tested by

no test coverage detected