JustinObanor/golang-channel-test/blob/feature/SBX-001/main.go

my func receive should output the data in my struct, which is the string, and the time. It does that, but then adds something really weird after the time - +0300 +03 m=+0.001997101
I dont know what that is, and i need to remove it please

2 Likes

HJustin, in my system is working fine. It shows

PS C:\temp\GolangProjects\test> go run t.go
Send : {widget_id_34 10:57:05.549990}
Receive: {widget_id_34 10:57:05.549990}

2 Likes

Mine unfortunately isint like that:
{widget_id_34 2019-08-28 11:41:26.9215223 +0300 +03 m=+0.002998401}
thats what i got

2 Likes

Which OS are you using ? Which Go version ?..

1 Like

It’s the monotonic clock. The documentation says:

The canonical way to strip a monotonic clock reading is to use t = t.Round(0).

Try changing line #54 to:

fmt.Println("[", w, t.Round(0).Format("15:04:05.000000"), "]")
2 Likes

Latest one. Ive solved the issue. Heres what i did -
chanValue := <-c:
t := chanValue.Time
w := chanValue.Label
fmt.Println("[", w, t.Format(β€œ15:04:05.000000”), β€œ]”)

1 Like

Thanks a lot. that did the trick

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.