53
53
//
54
54
// On some systems the monotonic clock will stop if the computer goes to sleep.
55
55
// On such a system, t.Sub(u) may not accurately reflect the actual
56
- // time that passed between t and u. This may impact a bunch of functions/methods:
57
- // [time. Since], [time. Until], [Time.Add ], [Time.Sub], [Time. After], [Time.Before]
58
- // [Time.Equal], [Time.Compare].
56
+ // time that passed between t and u. The same applies to other functions and
57
+ // methods that subtract times, such as [ Since], [Until], [Before ], [After] ...
58
+ // See issue: https://github.com/golang/go/issues/66870
59
59
// Use [Time.Round](0) or [Time.Truncate](0) to walkaround.
60
60
//
61
61
// Because the monotonic clock reading has no meaning outside
@@ -257,11 +257,6 @@ func (t *Time) mono() int64 {
257
257
}
258
258
259
259
// After reports whether the time instant t is after u.
260
- //
261
- // On some systems the monotonic clock will stop if the computer goes to sleep.
262
- // On such a system, this may not accurately reflect the actual time that
263
- // passed between t and u. Use [Time.Round](0) or [Time.Truncate](0) to walkaround.
264
- // See issue: https://github.com/golang/go/issues/66870
265
260
func (t Time ) After (u Time ) bool {
266
261
if t .wall & u .wall & hasMonotonic != 0 {
267
262
return t .ext > u .ext
@@ -272,11 +267,6 @@ func (t Time) After(u Time) bool {
272
267
}
273
268
274
269
// Before reports whether the time instant t is before u.
275
- //
276
- // On some systems the monotonic clock will stop if the computer goes to sleep.
277
- // On such a system, this may not accurately reflect the actual time that
278
- // passed between t and u. Use [Time.Round](0) or [Time.Truncate](0) to walkaround.
279
- // See issue: https://github.com/golang/go/issues/66870
280
270
func (t Time ) Before (u Time ) bool {
281
271
if t .wall & u .wall & hasMonotonic != 0 {
282
272
return t .ext < u .ext
@@ -288,11 +278,6 @@ func (t Time) Before(u Time) bool {
288
278
289
279
// Compare compares the time instant t with u. If t is before u, it returns -1;
290
280
// if t is after u, it returns +1; if they're the same, it returns 0.
291
- //
292
- // On some systems the monotonic clock will stop if the computer goes to sleep.
293
- // On such a system, this may not accurately reflect the actual time that
294
- // passed between t and u. Use [Time.Round](0) or [Time.Truncate](0) to walkaround.
295
- // See issue: https://github.com/golang/go/issues/66870
296
281
func (t Time ) Compare (u Time ) int {
297
282
var tc , uc int64
298
283
if t .wall & u .wall & hasMonotonic != 0 {
@@ -317,11 +302,6 @@ func (t Time) Compare(u Time) int {
317
302
// For example, 6:00 +0200 and 4:00 UTC are Equal.
318
303
// See the documentation on the Time type for the pitfalls of using == with
319
304
// Time values; most code should use Equal instead.
320
- //
321
- // On some systems the monotonic clock will stop if the computer goes to sleep.
322
- // On such a system, this may not accurately reflect the actual time that
323
- // passed between t and u. Use [Time.Round](0) or [Time.Truncate](0) to walkaround.
324
- // See issue: https://github.com/golang/go/issues/66870
325
305
func (t Time ) Equal (u Time ) bool {
326
306
if t .wall & u .wall & hasMonotonic != 0 {
327
307
return t .ext == u .ext
@@ -893,11 +873,6 @@ func (d Duration) Abs() Duration {
893
873
}
894
874
895
875
// Add returns the time t+d.
896
- // On some systems the monotonic clock will stop if the computer goes to sleep.
897
- //
898
- // On such a system, this may not accurately reflect the actual time that
899
- // t+d. Use [Time.Round](0) or [Time.Truncate](0) to walkaround.
900
- // See issue: https://github.com/golang/go/issues/66870
901
876
func (t Time ) Add (d Duration ) Time {
902
877
dsec := int64 (d / 1e9 )
903
878
nsec := t .nsec () + int32 (d % 1e9 )
@@ -926,11 +901,6 @@ func (t Time) Add(d Duration) Time {
926
901
// value that can be stored in a [Duration], the maximum (or minimum) duration
927
902
// will be returned.
928
903
// To compute t-d for a duration d, use t.Add(-d).
929
- //
930
- // On some systems the monotonic clock will stop if the computer goes to sleep.
931
- // On such a system, this may not accurately reflect the actual time that
932
- // passed between t and u. Use [Time.Round](0) or [Time.Truncate](0) to walkaround.
933
- // See issue: https://github.com/golang/go/issues/66870
934
904
func (t Time ) Sub (u Time ) Duration {
935
905
if t .wall & u .wall & hasMonotonic != 0 {
936
906
return subMono (t .ext , u .ext )
@@ -960,12 +930,6 @@ func subMono(t, u int64) Duration {
960
930
961
931
// Since returns the time elapsed since t.
962
932
// It is shorthand for time.Now().Sub(t).
963
- //
964
- // On some systems the monotonic clock will stop if the computer goes to sleep.
965
- // On such a system, this may not accurately reflect the actual time that
966
- // passed between t and process start time.
967
- // Use [Time.Round](0) or [Time.Truncate](0) to walkaround.
968
- // See issue: https://github.com/golang/go/issues/66870
969
933
func Since (t Time ) Duration {
970
934
if t .wall & hasMonotonic != 0 {
971
935
// Common case optimization: if t has monotonic time, then Sub will use only it.
@@ -976,12 +940,6 @@ func Since(t Time) Duration {
976
940
977
941
// Until returns the duration until t.
978
942
// It is shorthand for t.Sub(time.Now()).
979
- //
980
- // On some systems the monotonic clock will stop if the computer goes to sleep.
981
- // On such a system, this may not accurately reflect the actual time that
982
- // passed between t and now.
983
- // Use [Time.Round](0) or [Time.Truncate](0) to walkaround.
984
- // See issue: https://github.com/golang/go/issues/66870
985
943
func Until (t Time ) Duration {
986
944
if t .wall & hasMonotonic != 0 {
987
945
// Common case optimization: if t has monotonic time, then Sub will use only it.
0 commit comments