Commit 28ce6f36 authored by Shenghou Ma's avatar Shenghou Ma Committed by Minux Ma

time: document Tick will return nil if d <= 0

Fixes #14557.

Change-Id: I9610b79aafe9c15f9c998739b586fd0b41b90d70
Reviewed-on: https://go-review.googlesource.com/20031Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 1b417e20
...@@ -50,6 +50,7 @@ func (t *Ticker) Stop() { ...@@ -50,6 +50,7 @@ func (t *Ticker) Stop() {
// channel only. While Tick is useful for clients that have no need to shut down // channel only. While Tick is useful for clients that have no need to shut down
// the Ticker, be aware that without a way to shut it down the underlying // the Ticker, be aware that without a way to shut it down the underlying
// Ticker cannot be recovered by the garbage collector; it "leaks". // Ticker cannot be recovered by the garbage collector; it "leaks".
// Unlike NewTicker, Tick will return nil if d <= 0.
func Tick(d Duration) <-chan Time { func Tick(d Duration) <-chan Time {
if d <= 0 { if d <= 0 {
return nil return nil
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment