Skip to content

Commit

Permalink
UnixMilli
Browse files Browse the repository at this point in the history
  • Loading branch information
p0mvn committed Feb 17, 2023
1 parent 1af24c6 commit 7ee37c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion x/twap/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (k Keeper) getTwap(
if startTime.After(endTime) {
return sdk.Dec{}, types.StartTimeAfterEndTimeError{StartTime: startTime, EndTime: endTime}
}
fmt.Printf("start time (%d), end time (%d), block time (%d)", startTime.Unix(), endTime.Unix(), ctx.BlockTime().Unix())
fmt.Printf("start time (%d), end time (%d), block time (%d)", startTime.UnixMilli(), endTime.UnixMilli(), ctx.BlockTime().UnixMilli())
if endTime.Equal(ctx.BlockTime()) {
return k.getTwapToNow(ctx, poolId, baseAssetDenom, quoteAssetDenom, startTime, strategy)
} else if endTime.After(ctx.BlockTime()) {
Expand Down
10 changes: 5 additions & 5 deletions x/twap/logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ func recordWithUpdatedAccumulators(record types.TwapRecord, newTime time.Time) t
// If for the record obtained, r.Time == r.LastErrorTime, this will also hold for the interpolated record.
func (k Keeper) getInterpolatedRecord(ctx sdk.Context, poolId uint64, t time.Time, assetA, assetB string) (types.TwapRecord, error) {
record, err := k.getRecordAtOrBeforeTime(ctx, poolId, t, assetA, assetB)
fmt.Println("time ", t.Unix())
fmt.Println("time ", t.UnixMilli())
fmt.Println("recordAtOrBeforeTime ", record)
fmt.Println("AtOrBeforeTime ", record.Time.Unix())
fmt.Println("AtOrBeforeTime ", record.Time.UnixMilli())
if err != nil {
return types.TwapRecord{}, err
}
Expand All @@ -232,7 +232,7 @@ func (k Keeper) getInterpolatedRecord(ctx sdk.Context, poolId uint64, t time.Tim
}
record = recordWithUpdatedAccumulators(record, t)
fmt.Println("recordWithUpdatedAccumulators ", record)
fmt.Println("recordWithUpdatedAccumulators time ", record.Time.Unix())
fmt.Println("recordWithUpdatedAccumulators time ", record.Time.UnixMilli())
return record, nil
}

Expand All @@ -242,11 +242,11 @@ func (k Keeper) getMostRecentRecord(ctx sdk.Context, poolId uint64, assetA, asse
return types.TwapRecord{}, err
}
fmt.Println("mostRecentRecordStoreRepresentatione ", record)
fmt.Println("mostRecentRecordStoreRepresentatione time ", record.Time.Unix())
fmt.Println("mostRecentRecordStoreRepresentatione time ", record.Time.UnixMilli())
record = recordWithUpdatedAccumulators(record, ctx.BlockTime())

fmt.Println("mostRecent recordWithUpdatedAccumulators ", record)
fmt.Println("mostRecent recordWithUpdatedAccumulators time ", record.Time.Unix())
fmt.Println("mostRecent recordWithUpdatedAccumulators time ", record.Time.UnixMilli())
return record, nil
}

Expand Down

0 comments on commit 7ee37c4

Please sign in to comment.