diff options
| author | Jeff Carr <[email protected]> | 2025-10-12 03:32:26 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-12 03:32:26 -0500 |
| commit | aff745937b2c936f87cc48b82d0725f662bb1e30 (patch) | |
| tree | 374d37a352bb7e90f515db79bf7b41ea316c582b /since.go | |
| parent | a32b88646c02fd785687cd2a498b56410e62b2cd (diff) | |
Standard Time(). Perfect place for this. I am pleased.
Diffstat (limited to 'since.go')
| -rw-r--r-- | since.go | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -19,13 +19,14 @@ func Since(aLongTimeAgo any) string { return s } -func GetSince(aLongTimeAgo any) (time.Duration, error) { - return time.Second, NoTime -} - // returns a human readable duration // also returns errors -func SinceCheck(maybeTime any) (string, error) { +func SinceCheck(mightBeRecently any) (string, error) { + dur, err := GetSince(mightBeRecently) + return FormatDuration(dur), err +} + +func GetSince(maybeTime any) (time.Duration, error) { var t time.Time var err error @@ -52,11 +53,8 @@ func SinceCheck(maybeTime any) (string, error) { err = errors.Join(err, NoTime) } if err != nil { - return "", err + return time.Since(t), err } - dur := time.Since(t) - s := FormatDuration(dur) - - return s, nil + return time.Since(t), nil } |
