From 8b5bbef2514abdb87ab2e3241594685f660d7928 Mon Sep 17 00:00:00 2001 From: Bojan Date: Thu, 7 Nov 2019 22:10:33 -0400 Subject: [PATCH 1/2] Add TimestampUnixNano to call data as timestamp of the call as unix time in nanoseconds --- runner/call_template_data.go | 4 +++- www/docs/calldata.md | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/runner/call_template_data.go b/runner/call_template_data.go index 7dae8bd2..4a590eb3 100644 --- a/runner/call_template_data.go +++ b/runner/call_template_data.go @@ -21,7 +21,8 @@ type callTemplateData struct { IsClientStreaming bool // whether this call is client streaming IsServerStreaming bool // whether this call is server streaming Timestamp string // timestamp of the call in RFC3339 format - TimestampUnix int64 // timestamp of the call as unix time + TimestampUnix int64 // timestamp of the call as unix time in seconds + TimestampUnixNano int64 // timestamp of the call as unix time in nanoseconds } // newCallTemplateData returns new call template data @@ -40,6 +41,7 @@ func newCallTemplateData(mtd *desc.MethodDescriptor, workerID string, reqNum int IsServerStreaming: mtd.IsServerStreaming(), Timestamp: now.Format(time.RFC3339), TimestampUnix: now.Unix(), + TimestampUnixNano: now.UnixNano(), } } diff --git a/www/docs/calldata.md b/www/docs/calldata.md index abb275c5..4cfc74d1 100644 --- a/www/docs/calldata.md +++ b/www/docs/calldata.md @@ -39,8 +39,11 @@ type callTemplateData struct { // timestamp of the call in RFC3339 format Timestamp string - // timestamp of the call as unix time + // timestamp of the call as unix time in seconds TimestampUnix int64 + + // timestamp of the call as unix time in nanoseconds + TimestampUnixNano int64 } ``` From f2172ec59ef5cfed7d4033335776cd1c78cffda5 Mon Sep 17 00:00:00 2001 From: Bojan Date: Thu, 7 Nov 2019 22:13:32 -0400 Subject: [PATCH 2/2] Add test for TimestampUnixNano --- runner/call_template_data_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/runner/call_template_data_test.go b/runner/call_template_data_test.go index 829feb02..4e0fc3a5 100644 --- a/runner/call_template_data_test.go +++ b/runner/call_template_data_test.go @@ -26,6 +26,7 @@ func TestCallTemplateData_New(t *testing.T) { assert.Equal(t, false, ctd.IsServerStreaming) assert.NotEmpty(t, ctd.Timestamp) assert.NotZero(t, ctd.TimestampUnix) + assert.NotZero(t, ctd.TimestampUnixNano) } func TestCallTemplateData_ExecuteData(t *testing.T) {