-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed as not planned
Labels
LanguageChangeSuggested changes to the Go languageSuggested changes to the Go languageLanguageChangeReviewDiscussed by language change review committeeDiscussed by language change review committeeProposal
Milestone
Description
Go Programming Experience
Advanced
Other Languages Experience
C/C++, JavaScript
Related Idea
- Has this idea, or one like it, been proposed before?
- Does this affect error handling?
- Is this about generics?
- Is this change backward compatible? Breaking the Go 1 compatibility guarantee is a large cost and requires a large benefit
Has this idea, or one like it, been proposed before?
No
Does this affect error handling?
No
Is this about generics?
No
Proposal
Why to differ monotonic time? Simplification will help to reduce running time and make time.Now() more exact.
Compare
func Now() Time {
sec, nsec, _ := runtimeNow()
return Time{uint64(nsec), sec + unixToInternal, Local}
}and
func Now() Time {
sec, nsec, mono := runtimeNow()
if mono == 0 {
return Time{uint64(nsec), sec + unixToInternal, Local}
}
mono -= startNano
sec += unixToInternal - minWall
if uint64(sec)>>33 != 0 {
// Seconds field overflowed the 33 bits available when
// storing a monotonic time. This will be true after
// March 16, 2157.
return Time{uint64(nsec), sec + minWall, Local}
}
return Time{hasMonotonic | uint64(sec)<<nsecShift | uint64(nsec), mono, Local}
}Language Spec Changes
None
Informal Change
No response
Is this change backward compatible?
Yes. Nothing else changes to the exported methods of time.Time.
Orthogonality: How does this change interact or overlap with existing features?
No response
Would this change make Go easier or harder to learn, and why?
No response
Cost Description
No response
Changes to Go ToolChain
No response
Performance Costs
No response
Prototype
No response
tmthrgdtmthrgd
Metadata
Metadata
Assignees
Labels
LanguageChangeSuggested changes to the Go languageSuggested changes to the Go languageLanguageChangeReviewDiscussed by language change review committeeDiscussed by language change review committeeProposal