diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2018-04-19 01:06:33 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2018-04-19 01:06:33 -0400 |
| commit | 441edd4c01e158275039db882bf6b18d6f3fba8d (patch) | |
| tree | c6aa0e30cafc79a1c257868ef1bf36198df91dec /funcs | |
| parent | 02c8a39fd450efe61e79870a88f47ddeea787eac (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.go | 10 |
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) |
