]> Cypherpunks.ru repositories - gostls13.git/commitdiff
time: add comment explaining >>33 in Now
authorIan Lance Taylor <iant@golang.org>
Tue, 19 Jul 2022 22:09:21 +0000 (15:09 -0700)
committerBenny Siegert <bsiegert@gmail.com>
Wed, 28 Sep 2022 09:05:54 +0000 (09:05 +0000)
Change-Id: I022b617cd345b412bee0b50a862676a1dca94e01
Reviewed-on: https://go-review.googlesource.com/c/go/+/418376
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/time/time.go

index 0cd7a7e8a2761d7b39b41ef6206c26e8647e96c6..5da61510c1c5a9f3c9f5ef8c5d9a381421f14209 100644 (file)
@@ -1112,6 +1112,9 @@ func Now() Time {
        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}