Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing UTC Time to slots conversion #5142

Closed

Conversation

carbolymer
Copy link
Contributor

@carbolymer carbolymer commented Apr 21, 2023

Testing of #5130

It's not a final form of command line interface

@carbolymer
Copy link
Contributor Author

carbolymer commented Apr 21, 2023

So far appears to be not working correctly in previous eras. Querying slot around block 5385759 in Allegra era:

$ cabal exec cardano-cli -- calculateslottime --mainnet --socket-path ../network-mainnet/node.socket --utc-time "2021-02-24T22:48:45Z"                                                                                                     
CalculateSlotTimeCmd' (Just (SocketPath {unSocketPath = "../network-mainnet/node.socket"})) (AnyConsensusModeParams (CardanoModeParams (EpochSlots {unEpochSlots = 21600}))) Mainnet 2021-02-24 22:48:45 UTC
SLOTNO
SlotNo 22640634

Expected value: 22637034 via https://cardanoscan.io/block/5385759

EDIT: It appears that timezone might get mixed up somewhere, and if I shift the time by 1h, the returned result is correct now:

$ cabal exec cardano-cli -- calculateslottime --mainnet --socket-path ../network-mainnet/node.socket --utc-time "2021-02-24T21:48:45Z"
CalculateSlotTimeCmd' (Just (SocketPath {unSocketPath = "../network-mainnet/node.socket"})) (AnyConsensusModeParams (CardanoModeParams (EpochSlots {unEpochSlots = 21600}))) Mainnet 2021-02-24 21:48:45 UTC
SLOTNO
SlotNo 22637034

My machine uses Europe/Warsaw timezone, which is UTC+1 in winter, which may explain the discrepancy.

@carbolymer
Copy link
Contributor Author

carbolymer commented Apr 24, 2023

Babbage era - for UTC+2 time difference

CalculateSlotTimeCmd' (Just (SocketPath {unSocketPath = "../network-mainnet/node.socket"})) (AnyConsensusModeParams (CardanoModeParams (EpochSlots {unEpochSlots = 21600}))) Mainnet 2023-04-24 09:12:42 UTC
SLOTNO
SlotNo 90761271

https://cardanoscan.io/block/8687402

@carbolymer
Copy link
Contributor Author

carbolymer commented Apr 24, 2023

Byron era - for UTC+2 difference:

cabal exec cardano-cli -- calculateslottime --mainnet --socket-path ../network-mainnet/node.socket --utc-time "2017-09-28T21:38:11Z"
CalculateSlotTimeCmd' (Just (SocketPath {unSocketPath = "../network-mainnet/node.socket"})) (AnyConsensusModeParams (CardanoModeParams (EpochSlots {unEpochSlots = 21600}))) Mainnet 2017-09-28 21:38:11 UTC
SLOTNO
SlotNo 21580

https://cardanoscan.io/block/21567

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant