From 2546a57b5e929331197c667842610badc3492464 Mon Sep 17 00:00:00 2001 From: Ian McEwen Date: Thu, 5 Sep 2024 11:39:51 -0700 Subject: [PATCH] Format time-running as H(HH):MM, not default format with ridiculous precision --- main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index b4ad92f..3165b1c 100644 --- a/main.go +++ b/main.go @@ -169,9 +169,15 @@ func SendPeriodicNotification(ctx context.Context, j *Job) error { if err != nil { return errors.Wrapf(err, "failed to parse start date %s", j.StartDate) } - dur := time.Since(starttime) - subject := fmt.Sprintf(PeriodicSubjectFormat, j.Name, starttime, dur) + // just print H(HH):MM format + dur := time.Since(starttime).Round(time.Minute) + h := dur / time.Hour + dur -= h * time.Hour + m := dur / time.Minute + durString := fmt.Sprintf("%d:%02d", h, m) + + subject := fmt.Sprintf(PeriodicSubjectFormat, j.Name, starttime, durString) msg := fmt.Sprintf( PeriodicMessageFormat,