Created
August 31, 2019 01:06
-
-
Save matutter/a5890215c4b6c6ae141538da7ecccb42 to your computer and use it in GitHub Desktop.
Shows how ms-since-epoch TS that are truncated to fit in int32_t space will look.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from subprocess import check_output | |
| from datetime import datetime | |
| ms_since_epoch = check_output([ | |
| "node", | |
| "-e", | |
| "console.log(require('moment')().valueOf())" | |
| ]) | |
| dt = datetime.fromtimestamp(float(ms_since_epoch) / 1000.0) | |
| print(ms_since_epoch) | |
| print(dt) | |
| ts = ms_since_epoch[:10] | |
| dt = datetime.fromtimestamp(int(ts)) | |
| print(ts) | |
| print(dt) | |
| ts = ms_since_epoch[-11:] | |
| dt = datetime.fromtimestamp(int(ts)) | |
| print(ts) | |
| print(dt) |
Author
matutter
commented
Aug 31, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment