From 1add32b4d95c5c7c3f12e50a53b0c87e7a8f8e66 Mon Sep 17 00:00:00 2001 From: Alessandro Arzilli Date: Tue, 20 Sep 2022 22:05:57 +0200 Subject: [PATCH] terminal: do not use WaitSince as unix time (#3139) 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 #3137 --- pkg/terminal/command.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/terminal/command.go b/pkg/terminal/command.go index c01cae66..3fc3a16f 100644 --- a/pkg/terminal/command.go +++ b/pkg/terminal/command.go @@ -23,7 +23,6 @@ import ( "strconv" "strings" "text/tabwriter" - "time" "github.com/cosiner/argv" "github.com/go-delve/delve/pkg/config" @@ -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, "]") }