Skip to content

Commit

Permalink
Format time-running as H(HH):MM, not default format with ridiculous p…
Browse files Browse the repository at this point in the history
…recision
  • Loading branch information
ianmcorvidae committed Sep 5, 2024
1 parent 8fc67d2 commit 2546a57
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2546a57

Please sign in to comment.