Standard library / time

time.Tick()

Return the periodic tick channel, or nil for a nonpositive interval. Use NewTicker if explicit stopping is needed. On Go 1.23, channel-timer rules depend on the main module go directive and GODEBUG=asynctimerchan; see compatibility notes. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func Tick(d Duration) <-chan Time

Parameters & Attributes

NameTypeDescription
dDurationElapsed duration or interval.

Return Value

<-chan Time

Return the periodic tick channel, or nil for a nonpositive interval.

Working Example

Example Snippetgo
package main
import (  "fmt"  "time")
func main() { fmt.Println(time.Tick(0) == nil) }
Go Reference