Repository: bojand/ghz (go)

Issue:
UnixTimestamp call template in milliseconds
**Is your feature request related to a problem? Please describe.**
My GPRC interface accepts unix epoch time in milliseconds but the current call template only returns values in seconds.

**Describe the solution you'd like**
I would like an additional call template variable that returns the unix timestamp in milliseconds.


Pull request description:
Add Unix Nanosecond timestamp. Fixes #141.
Add TimestampUnixNano to call data as timestamp of the call as unix time in nanoseconds. Fixes #141.

Patch:
diff --git a/runner/call_template_data.go b/runner/call_template_data.go
index 7dae8bd..4a590eb 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 abb275c..4cfc74d 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
 }
 ```
 


Test patch:
diff --git a/runner/call_template_data_test.go b/runner/call_template_data_test.go
index 829feb0..4e0fc3a 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) {