diff options
author | Rainer Borene <[email protected]> | 2021-08-16 18:06:44 -0300 |
---|---|---|
committer | GitHub <[email protected]> | 2021-08-16 15:06:44 -0600 |
commit | 1b1e625c201bdc2570dded6164e212f3abda902c (patch) | |
tree | f5590672ce3b29db906f3c289fdf9f4ef02f4bca /replacer.go | |
parent | a10910f3981908424493c043d26dfcb4e5f8dc25 (diff) | |
download | caddy-1b1e625c201bdc2570dded6164e212f3abda902c.tar.gz caddy-1b1e625c201bdc2570dded6164e212f3abda902c.zip |
core: Unix ns and Unix ms time placeholders (#4280)
Diffstat (limited to 'replacer.go')
-rw-r--r-- | replacer.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/replacer.go b/replacer.go index e6cfdede7..bffc42448 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 |