From 1b1e625c201bdc2570dded6164e212f3abda902c Mon Sep 17 00:00:00 2001 From: Rainer Borene Date: Mon, 16 Aug 2021 18:06:44 -0300 Subject: core: Unix ns and Unix ms time placeholders (#4280) --- replacer.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'replacer.go') diff --git a/replacer.go b/replacer.go index e6cfded..bffc424 100644 --- a/replacer.go +++ b/replacer.go @@ -301,6 +301,10 @@ func globalDefaultReplacements(key string) (interface{}, bool) { return nowFunc().Format("02/Jan/2006:15:04:05 -0700"), true case "time.now.year": return strconv.Itoa(nowFunc().Year()), true + case "time.now.unix": + return strconv.FormatInt(nowFunc().Unix(), 10), true + case "time.now.unix_ms": + return strconv.FormatInt(nowFunc().UnixNano()/int64(time.Millisecond), 10), true } return nil, false -- cgit v1.2.3