mirror of
https://github.com/golang/go
synced 2024-11-19 15:14:45 -07:00
time: fix documentation of Round, Truncate behavior for d <= 0
Saying that they return t unchanged is misleading, because they return a modified t, stripped of any monotonic clock reading, as of Go 1.9. Fixes #21485. Change-Id: Icddf8813aed3d687fcefcd2fe542829438be6a0a Reviewed-on: https://go-review.googlesource.com/56690 Reviewed-by: Avelino <t@avelino.xxx> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
f2c0531795
commit
b793372125
@ -1383,7 +1383,7 @@ func Date(year int, month Month, day, hour, min, sec, nsec int, loc *Location) T
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Truncate returns the result of rounding t down to a multiple of d (since the zero time).
|
// Truncate returns the result of rounding t down to a multiple of d (since the zero time).
|
||||||
// If d <= 0, Truncate returns t unchanged.
|
// If d <= 0, Truncate returns t stripped of any monotonic clock reading but otherwise unchanged.
|
||||||
//
|
//
|
||||||
// Truncate operates on the time as an absolute duration since the
|
// Truncate operates on the time as an absolute duration since the
|
||||||
// zero time; it does not operate on the presentation form of the
|
// zero time; it does not operate on the presentation form of the
|
||||||
@ -1400,7 +1400,7 @@ func (t Time) Truncate(d Duration) Time {
|
|||||||
|
|
||||||
// Round returns the result of rounding t to the nearest multiple of d (since the zero time).
|
// Round returns the result of rounding t to the nearest multiple of d (since the zero time).
|
||||||
// The rounding behavior for halfway values is to round up.
|
// The rounding behavior for halfway values is to round up.
|
||||||
// If d <= 0, Round returns t unchanged.
|
// If d <= 0, Round returns t stripped of any monotonic clock reading but otherwise unchanged.
|
||||||
//
|
//
|
||||||
// Round operates on the time as an absolute duration since the
|
// Round operates on the time as an absolute duration since the
|
||||||
// zero time; it does not operate on the presentation form of the
|
// zero time; it does not operate on the presentation form of the
|
||||||
|
Loading…
Reference in New Issue
Block a user