Skip to content

Commit

Permalink
terminal: do not use WaitSince as unix time (go-delve#3139)
Browse files Browse the repository at this point in the history
g.waitsince is the output of runtime.nanotime and represents a
monotonic clock which can not be converted directly into unix time. A
better fix would be to convert it to a time.Duration by reading the
current value of runtime.nanotime. This is complicated, however,
because on some systems (for example macOS) the current value of
runtime.nanotime can only be read by making a system call.

Updates go-delve#3137
  • Loading branch information
aarzilli authored Sep 20, 2022
1 parent 5ebf020 commit 1add32b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/terminal/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"strconv"
"strings"
"text/tabwriter"
"time"

"github.com/cosiner/argv"
"github.com/go-delve/delve/pkg/config"
Expand Down Expand Up @@ -1076,7 +1075,7 @@ func (t *Term) formatGoroutine(g *api.Goroutine, fgl api.FormatGoroutineLoc) str
}
fmt.Fprintf(buf, " [%s", wr)
if g.WaitSince > 0 {
fmt.Fprintf(buf, " %s", time.Since(time.Unix(0, g.WaitSince)).String())
fmt.Fprintf(buf, " %d", g.WaitSince)
}
fmt.Fprintf(buf, "]")
}
Expand Down

0 comments on commit 1add32b

Please sign in to comment.