Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Avoid negative elapsed the display when only one event is sent. #1230

Merged
merged 1 commit into from
Feb 3, 2021

Conversation

gtardif
Copy link
Contributor

@gtardif gtardif commented Feb 3, 2021

Signed-off-by: Guillaume Tardif [email protected]

What I did

  • If endTime is not set when displaying elapsed time, init as starTime (=> elapsed = 0)

Related issue
Fixes #1227

(not mandatory) A picture of a cute animal, if possible in relation with what you did

@gtardif gtardif requested a review from aiordache February 3, 2021 14:30
@github-actions github-actions bot added the api api label Feb 3, 2021
@@ -154,7 +154,11 @@ func (w *ttyWriter) print() {
func lineText(event Event, pad string, terminalWidth, statusPadding int, color bool) string {
endTime := time.Now()
if event.Status != Working {
endTime = event.endTime
if (event.endTime != time.Time{}) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be easier to read?

endTime = event.startTime
if (event.endTime != time.Time{}) {
     endTime = event.endTime
}

@gtardif gtardif force-pushed the fix_progress_time_display branch from 89e600a to f0dbc60 Compare February 3, 2021 14:40
@gtardif gtardif merged commit af62c52 into docker-archive:main Feb 3, 2021
@gtardif gtardif deleted the fix_progress_time_display branch February 3, 2021 14:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api api
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Progress bug: negative time displayed sometimes
2 participants