From d3768c5f5693fd5ea0ec1aa58c897d86c3a89995 Mon Sep 17 00:00:00 2001 From: Ben Sigelman Date: Mon, 19 Sep 2016 14:57:55 -0700 Subject: [PATCH] Handle the IsZero timestamp case --- span.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/span.go b/span.go index 903412c..f6c3234 100644 --- a/span.go +++ b/span.go @@ -162,8 +162,14 @@ type LogData struct { // ToLogRecord converts a deprecated LogData to a non-deprecated LogRecord func (ld *LogData) ToLogRecord() LogRecord { + var literalTimestamp time.Time + if ld.Timestamp.IsZero() { + literalTimestamp = time.Now() + } else { + literalTimestamp = ld.Timestamp + } rval := LogRecord{ - Timestamp: ld.Timestamp, + Timestamp: literalTimestamp, } if ld.Payload == nil { rval.Fields = []log.Field{