github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/blog/content/playground/time.go (about)

     1  // +build OMIT
     2  
     3  package main
     4  
     5  import (
     6  	"fmt"
     7  	"time"
     8  )
     9  
    10  func main() {
    11  	stop := time.After(3 * time.Second)
    12  	tick := time.NewTicker(1 * time.Second)
    13  	defer tick.Stop()
    14  	for {
    15  		select {
    16  		case <-tick.C:
    17  			fmt.Println(time.Now())
    18  		case <-stop:
    19  			return
    20  		}
    21  	}
    22  }