go sleep code example
Example 1: golang sleep
package main
import (
"fmt"
"time"
)
func main() {
fmt.Printf("Current Unix Time: %v\n", time.Now().Unix())
time.Sleep(2 * time.Second)
fmt.Printf("Current Unix Time: %v\n", time.Now().Unix())
}
Example 2: go packae unix time
package main
import (
"fmt"
"time"
)
func unixtime() {
fmt.Println(time.Now().Unix())
}