Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Unix Nanosecond timestamp. Fixes #141. #142

Merged
merged 2 commits into from
Nov 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion runner/call_template_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(),
}
}

Expand Down
1 change: 1 addition & 0 deletions runner/call_template_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion www/docs/calldata.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
```

Expand Down