From 39d44980c587a1306a6352846d05f9b4ea940f19 Mon Sep 17 00:00:00 2001 From: tidwall Date: Thu, 2 Aug 2018 17:36:18 -0700 Subject: [PATCH] Moved json time formatting --- pkg/controller/fence.go | 11 ----------- pkg/controller/json.go | 13 +++++++++++++ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/pkg/controller/fence.go b/pkg/controller/fence.go index 8f7a0eea..311fb45d 100644 --- a/pkg/controller/fence.go +++ b/pkg/controller/fence.go @@ -25,17 +25,6 @@ func FenceMatch(hookName string, sw *scanWriter, fence *liveFenceSwitches, metas } return nmsgs } -func appendJSONTimeFormat(b []byte, t time.Time) []byte { - b = append(b, '"') - b = t.AppendFormat(b, "2006-01-02T15:04:05.999999999Z07:00") - b = append(b, '"') - return b -} -func jsonTimeFormat(t time.Time) string { - var b []byte - b = appendJSONTimeFormat(b, t) - return string(b) -} func appendHookDetails(b []byte, hookName string, metas []FenceMeta) []byte { if len(hookName) > 0 { b = append(b, `,"hook":`...) diff --git a/pkg/controller/json.go b/pkg/controller/json.go index 749f2722..d0b9b228 100644 --- a/pkg/controller/json.go +++ b/pkg/controller/json.go @@ -42,6 +42,19 @@ func jsonString(s string) string { return string(b) } +func appendJSONTimeFormat(b []byte, t time.Time) []byte { + b = append(b, '"') + b = t.AppendFormat(b, "2006-01-02T15:04:05.999999999Z07:00") + b = append(b, '"') + return b +} + +func jsonTimeFormat(t time.Time) string { + var b []byte + b = appendJSONTimeFormat(b, t) + return string(b) +} + func (c *Controller) cmdJget(msg *server.Message) (resp.Value, error) { start := time.Now()