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


(Justin) #1

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


(Yamil Bracho) #2

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}


(Justin) #3

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


(Yamil Bracho) #4

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


(Sean Killian) #5

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"), "]")

(Justin) #6

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”), “]”)


(Justin) #7

Thanks a lot. that did the trick