mirror of https://github.com/tidwall/tile38.git
Moved json time formatting
This commit is contained in:
parent
632b0ebf63
commit
39d44980c5
|
@ -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":`...)
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue