Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time: Lack of monotonic time support on Solaris #33674

Closed
AudriusButkevicius opened this issue Aug 15, 2019 · 2 comments
Closed

time: Lack of monotonic time support on Solaris #33674

AudriusButkevicius opened this issue Aug 15, 2019 · 2 comments

Comments

@AudriusButkevicius
Copy link
Contributor

@AudriusButkevicius AudriusButkevicius commented Aug 15, 2019

What version of Go are you using (go version)?

1.12.17

Does this issue reproduce with the latest release?

I have no means of testing due to lack of access to the platform, but looking at the code it seems it should still happen on master.

What operating system and processor architecture are you using (go env)?

solaris amd64

What did you do?

Compared two values of time.Now() not that far from each other.
The latter time.Now() value was smaller than the value acquired first.

Essentially:

	x := time.Now()
	y := time.Now()
	fmt.Println(y.Sub(x))

resulted in a negative difference

What did you expect to see?

Difference in time to be zero or positive

What did you see instead?

The time difference was negative 87ms.

It seems that the problem stems from:
https://github.com/golang/go/blob/master/src/runtime/sys_solaris_amd64.s#L42

which still uses CLOCK_REALTIME

This originates from: lucas-clemente/quic-go#2059

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Aug 17, 2019

It does seem like we should change walltime to use CLOCK_REALTIME and change nanotime to use CLOCK_MONOTONIC. That's how it works on GNU/Linux.

@gopherbot
Copy link

@gopherbot gopherbot commented Oct 7, 2019

Change https://golang.org/cl/199502 mentions this issue: runtime: make nanotime use monotonic clock in Solaris

@gopherbot gopherbot closed this in 2df5cdb Oct 11, 2019
@golang golang locked and limited conversation to collaborators Oct 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.