summaryrefslogtreecommitdiff
path: root/funcs
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2018-04-19 01:06:33 -0400
committerDave Henderson <dhenderson@gmail.com>2018-04-19 01:06:33 -0400
commit441edd4c01e158275039db882bf6b18d6f3fba8d (patch)
treec6aa0e30cafc79a1c257868ef1bf36198df91dec /funcs
parent02c8a39fd450efe61e79870a88f47ddeea787eac (diff)
Adding time.Since and time.Until wrappers
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'funcs')
-rw-r--r--funcs/time.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/funcs/time.go b/funcs/time.go
index 111b0b23..d1030cab 100644
--- a/funcs/time.go
+++ b/funcs/time.go
@@ -143,6 +143,16 @@ func (f *TimeFuncs) ParseDuration(n interface{}) (gotime.Duration, error) {
return gotime.ParseDuration(conv.ToString(n))
}
+// Since -
+func (f *TimeFuncs) Since(n gotime.Time) gotime.Duration {
+ return gotime.Since(n)
+}
+
+// Until -
+func (f *TimeFuncs) Until(n gotime.Time) gotime.Duration {
+ return gotime.Until(n)
+}
+
// convert a number input to a pair of int64s, representing the integer portion and the decimal remainder
// this can handle a string as well as any integer or float type
// precision is at the "nano" level (i.e. 1e+9)