Create time Package for Shared/timeutil, mclock and slotutil (#9594)

* add time pkg

* Go fmt
This commit is contained in:
terence tsao
2021-09-14 17:09:04 -07:00
committed by GitHub
parent 77de467250
commit 3e71997290
115 changed files with 322 additions and 320 deletions

View File

@@ -13,8 +13,8 @@ import (
validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
"github.com/prysmaticlabs/prysm/shared/bls"
"github.com/prysmaticlabs/prysm/shared/params"
"github.com/prysmaticlabs/prysm/shared/slotutil"
"github.com/prysmaticlabs/prysm/shared/timeutils"
prysmTime "github.com/prysmaticlabs/prysm/time"
"github.com/prysmaticlabs/prysm/time/slots"
"go.opencensus.io/trace"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@@ -149,13 +149,13 @@ func (v *validator) waitToSlotTwoThirds(ctx context.Context, slot types.Slot) {
ctx, span := trace.StartSpan(ctx, "validator.waitToSlotTwoThirds")
defer span.End()
oneThird := slotutil.DivideSlotBy(3 /* one third of slot duration */)
oneThird := slots.DivideSlotBy(3 /* one third of slot duration */)
twoThird := oneThird + oneThird
delay := twoThird
startTime := slotutil.SlotStartTime(v.genesisTime, slot)
startTime := slots.SlotStartTime(v.genesisTime, slot)
finalTime := startTime.Add(delay)
wait := timeutils.Until(finalTime)
wait := prysmTime.Until(finalTime)
if wait <= 0 {
return
}