Golang time.NewTicker(), Stop() functions and Ticker type example
package time
Golang time.NewTicker(), Stop() functions and Ticker type usage example
package main
import (
"fmt"
"time"
)
const Count = 10
func main() {
Delta := 100 * time.Millisecond
ticker := time.NewTicker(Delta)
for i := 0; i < Count; i++ {
<-ticker.C
fmt.Println("tick")
}
ticker.Stop()
}
References :
http://golang.org/pkg/time/#Ticker
Advertisement
Something interesting
Tutorials
+36.5k Golang : Convert date or time stamp from string to time.Time type
+16.5k Golang : Send email and SMTP configuration example
+16.5k Golang : Test floating point numbers not-a-number and infinite example
+25.3k Golang : Convert uint value to string type
+13.5k Golang : error parsing regexp: invalid or unsupported Perl syntax
+13.8k Golang : Image to ASCII art example
+11.3k Golang : Fix - does not implement sort.Interface (missing Len method)
+32.6k Golang : Copy directory - including sub-directories and files
+17.6k Golang : Linked list example
+9.5k Golang : Play .WAV file from command line
+7.7k Android Studio : AlertDialog to get user attention example
+14k Golang : How to check if a file is hidden?