File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -155,7 +155,16 @@ func initialisePackageManager(localPath string, srcPathGetter pkg.SourcePathGett
155155}
156156
157157func formatDuration (t time.Duration ) string {
158- return fmt .Sprintf ("%02.f:%02.f:%02.f" , t .Hours (), t .Minutes (), t .Seconds ())
158+ switch {
159+ case t >= time .Minute : // 1m23s or 2h45m12s
160+ t = t .Round (time .Second )
161+ case t >= time .Second : // 45.36s
162+ t = t .Round (10 * time .Millisecond )
163+ default : // 51ms
164+ t = t .Round (time .Millisecond )
165+ }
166+
167+ return t .String ()
159168}
160169
161170func initJobManager (cfg * config.Config ) * job.Manager {
@@ -177,7 +186,7 @@ func initJobManager(cfg *config.Config) *job.Manager {
177186 }
178187
179188 timeElapsed := j .EndTime .Sub (* j .StartTime )
180- msg := fmt .Sprintf ("Task \" %s\" is finished in %s." , cleanDesc , formatDuration (timeElapsed ))
189+ msg := fmt .Sprintf ("Task \" %s\" finished in %s." , cleanDesc , formatDuration (timeElapsed ))
181190 desktop .SendNotification ("Task Finished" , msg )
182191 }
183192 case <- ctx .Done ():
You can’t perform that action at this time.
0 commit comments