MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / nextTick

Method nextTick

blockproducer/chain.go:953–967  ·  view source on GitHub ↗

nextTick returns the current clock reading and the duration till the next turn. If duration is less or equal to 0, use the clock reading to run the next cycle - this avoids some problem caused by concurrent time synchronization.

()

Source from the content-addressed store, hash-verified

951// is less or equal to 0, use the clock reading to run the next cycle - this avoids some problem
952// caused by concurrent time synchronization.
953func (c *Chain) nextTick() (t time.Time, d time.Duration) {
954 var h uint32
955 h, t = func() (nt uint32, t time.Time) {
956 c.RLock()
957 defer c.RUnlock()
958 nt = c.nextHeight
959 t = time.Now().Add(c.offset).UTC()
960 return
961 }()
962 d = c.genesisTime.Add(time.Duration(h) * c.period).Sub(t)
963 if d > c.tick {
964 d = c.tick
965 }
966 return
967}
968
969func (c *Chain) isMyTurn() bool {
970 c.RLock()

Callers 1

mainCycleMethod · 0.95

Calls 1

AddMethod · 0.45

Tested by

no test coverage detected