mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 07:58:22 -05:00
14 lines
437 B
Go
14 lines
437 B
Go
package utils
|
|
|
|
import "time"
|
|
|
|
// BlockingWait sleeps until a specific time is reached after
|
|
// a certain duration. For example, if the genesis block
|
|
// was at 12:00:00PM and the current time is 12:00:03PM,
|
|
// we want the next slot to tick at 12:00:08PM so we can use
|
|
// this helper method to achieve that purpose.
|
|
func BlockingWait(duration time.Duration) {
|
|
d := time.Until(time.Now().Add(duration).Truncate(duration))
|
|
time.Sleep(d)
|
|
}
|