aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitri Shuralyov <shurcooL@gmail.com>2017-08-17 19:30:34 -0400
committerRuss Cox <rsc@golang.org>2017-10-25 20:22:45 +0000
commit2e4358c960dbdea925ff879cca7f5de57f2e8629 (patch)
tree78ed1fd9ba2e87cee5d2ab94c2ec2e052628a8fa
parentc6388d381ee4b62c56b499bc8a8d3127af86faa3 (diff)
downloadgo-2e4358c960dbdea925ff879cca7f5de57f2e8629.tar.gz
go-2e4358c960dbdea925ff879cca7f5de57f2e8629.zip
[release-branch.go1.9] 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> Reviewed-on: https://go-review.googlesource.com/70846 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Russ Cox <rsc@golang.org>
-rw-r--r--src/time/time.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/time/time.go b/src/time/time.go
index 8a29eef263..0f29b0ff93 100644
--- a/src/time/time.go
+++ b/src/time/time.go
@@ -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).
-// 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
// 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).
// 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
// zero time; it does not operate on the presentation form of the