Replies: 5 comments
-
It’s a unixtimestamp in milliseconds
…On Mon, Oct 18, 2021 at 16:32, stolpa4 ***@***.***> wrote:
Hello, I found that for recent blocks (polkadot) the timestamp extrinsic is parsed with extrinsic['call']['call_args']['type'] == 'Moment' and value is some rather big number (e.g. for block 7313001 it is 1634560404001) - clearly it is not a Unix timestamp. How can I parse this number into timestamp?
I've used to parse timestamp values as strings in format '%Y-%m-%dT%H:%M:%S.%f', but it worker for timestamps with extrinsic['call']['call_args']['type'] == 'Compact<Moment>'.
Now the parsed value is integer.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, [view it on GitHub](#144), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AAUYENIWUPXNPCOAGKB55BDUHQOVPANCNFSM5GGVJFHQ).
Triage notifications on the go with GitHub Mobile for [iOS](https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675) or [Android](https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub).
|
Beta Was this translation helpful? Give feedback.
-
If you don’t care for ms precision then simply divide by 1000 and round down
…On Mon, Oct 18, 2021 at 16:32, stolpa4 ***@***.***> wrote:
Hello, I found that for recent blocks (polkadot) the timestamp extrinsic is parsed with extrinsic['call']['call_args']['type'] == 'Moment' and value is some rather big number (e.g. for block 7313001 it is 1634560404001) - clearly it is not a Unix timestamp. How can I parse this number into timestamp?
I've used to parse timestamp values as strings in format '%Y-%m-%dT%H:%M:%S.%f', but it worker for timestamps with extrinsic['call']['call_args']['type'] == 'Compact<Moment>'.
Now the parsed value is integer.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, [view it on GitHub](#144), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AAUYENIWUPXNPCOAGKB55BDUHQOVPANCNFSM5GGVJFHQ).
Triage notifications on the go with GitHub Mobile for [iOS](https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675) or [Android](https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub).
|
Beta Was this translation helpful? Give feedback.
-
@maayank Thanks! |
Beta Was this translation helpful? Give feedback.
-
@stolpa4 yes this is a inconsistency we have to fix, so the result with all metadata versions will be the same. I will reopen this issue to convert a |
Beta Was this translation helpful? Give feedback.
-
After some discussion how to deal with the |
Beta Was this translation helpful? Give feedback.
-
Hello, I found that for recent blocks (polkadot) the timestamp extrinsic is parsed with
extrinsic['call']['call_args']['type'] == 'Moment'
and value is some rather big number (e.g. for block 7313001 it is 1634560404001) - clearly it is not a Unix timestamp. How can I parse this number into timestamp?I've used to parse timestamp values as strings in format
'%Y-%m-%dT%H:%M:%S.%f'
, but it worker for timestamps withextrinsic['call']['call_args']['type'] == 'Compact<Moment>'
.Now when the call value is integer, I need to introduce some changes to my code, but I can't find what format the timestamp value is.
Beta Was this translation helpful? Give feedback.
All reactions