Browse Source

core: Unix ns and Unix ms time placeholders (#4280)

master
Rainer Borene 3 years ago
committed by GitHub
parent
commit
1b1e625c20
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      replacer.go

4
replacer.go

@ -301,6 +301,10 @@ func globalDefaultReplacements(key string) (interface{}, bool) {
return nowFunc().Format("02/Jan/2006:15:04:05 -0700"), true return nowFunc().Format("02/Jan/2006:15:04:05 -0700"), true
case "time.now.year": case "time.now.year":
return strconv.Itoa(nowFunc().Year()), true 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 return nil, false

Loading…
Cancel
Save