Go Package time: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 19: Line 19:
<pre>
<pre>
import "time"
import "time"
...
...
time.Sleep(100 * time.Millisecond)
time.Sleep(100 * time.Millisecond)
</pre>
</pre>

Revision as of 19:17, 20 April 2016

External

Internal

Overview

  • time.After returns a channel that after the given duration, will send current time on it. This can be used to implement a timeout with select.

time.Sleep()

Sleep pauses the current goroutine for at least the duration d. A negative or zero duration causes Sleep to return immediately:

import "time"
...
time.Sleep(100 * time.Millisecond)