Skip to content

Commit 6648e8f

Browse files
authored
unconditionally use int64 for times (#7692)
* unconditionally use int64 for times * import inSeconds
1 parent 733f6cd commit 6648e8f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

beacon_chain/beacon_clock.nim

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import
1313
chronos/timer, chronicles,
1414
./spec/beacon_time
1515

16-
from std/times import Time, getTime, fromUnix, toUnix, `<`, `-`, inNanoseconds
16+
from std/times import
17+
Time, getTime, fromUnix, toUnix, `<`, `-`, inNanoseconds, inSeconds
1718

1819
export timer.Duration, Moment, now, beacon_time
1920

@@ -55,12 +56,12 @@ proc init*(
5556
unixGenesis = fromUnix(genesis_time.int64)
5657
# GENESIS_SLOT offsets slot time, but to simplify calculations, we apply
5758
# that offset to genesis instead of applying it at every time conversion
58-
unixGenesisOffset = times.seconds(
59+
unixGenesisOffset = fromUnix(
5960
(GENESIS_SLOT.int64 * timeParams.SLOT_DURATION).seconds)
6061

6162
Opt.some T(
6263
timeParams: timeParams,
63-
genesis: unixGenesis - unixGenesisOffset)
64+
genesis: (unixGenesis - unixGenesisOffset).inSeconds.fromUnix)
6465

6566
func timeParams*(c: BeaconClock): TimeParams =
6667
c.timeParams # Readonly

0 commit comments

Comments
 (0)