Logo

Programming-Idioms

History of Idiom 45 > diff from v9 to v10

Edit summary for version 10 by :

Version 9

2015-08-21, 09:39:45

Version 10

2015-08-21, 23:21:29

Idiom #45 Pause execution for 5 seconds

Sleep for 5 seconds in current thread, before proceeding with next instructions.

Idiom #45 Pause execution for 5 seconds

Sleep for 5 seconds in current thread, before proceeding with next instructions.

Imports
import "time"
Imports
import "time"
Code
time.Sleep(5 * time.Second)
Code
time.Sleep(5 * time.Second)
Comments bubble
Unit is Duration, an alias for int64 representing a number of nanoseconds.
But the constant Second helps readability.
Comments bubble
Unit is Duration, an alias for int64 representing a number of nanoseconds.
But the constant Second helps readability.
Doc URL
http://golang.org/pkg/time/#Sleep
Origin
http://golang.org/pkg/time/#Sleep
Demo URL
http://play.golang.org/p/q_MCP3SHWG
Demo URL
http://play.golang.org/p/q_MCP3SHWG