Last active
March 5, 2023 00:13
-
-
Save nocarryr/e84eadcda16f37631995c16ead2a53f6 to your computer and use it in GitHub Desktop.
This file contains 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
{ | |
"metadata": { | |
"language_info": { | |
"codemirror_mode": { | |
"name": "python", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.8" | |
}, | |
"kernelspec": { | |
"name": "python", | |
"display_name": "Python (Pyodide)", | |
"language": "python" | |
} | |
}, | |
"nbformat_minor": 4, | |
"nbformat": 4, | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"source": "import datetime\nimport pytz\nlocal_tz = pytz.timezone('US/Central')\nutc = pytz.UTC", | |
"metadata": { | |
"trusted": true | |
}, | |
"execution_count": 1, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": "screenshot_dt = datetime.datetime(2023, 3, 4, 11, 53)\nscreenshot_dt = local_tz.localize(screenshot_dt)\ntimer_delta = datetime.timedelta(hours=14, minutes=28)\ntimer_dt = screenshot_dt + timer_delta\n\nscreenshot_dt_utc = utc.normalize(screenshot_dt)\ntimer_dt_utc = screenshot_dt_utc + timer_delta", | |
"metadata": { | |
"trusted": true | |
}, | |
"execution_count": 2, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": "assert screenshot_dt == screenshot_dt_utc\nassert timer_dt_utc == timer_dt", | |
"metadata": { | |
"trusted": true | |
}, | |
"execution_count": 3, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"source": "print(f'{screenshot_dt} (ss time local)')\nprint(f'{screenshot_dt_utc} (ss time UTC)')\nprint(f'{timer_dt} (timer time local)')\nprint(f'{timer_dt_utc} (timer time UTC)')", | |
"metadata": { | |
"trusted": true | |
}, | |
"execution_count": 4, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"text": "2023-03-04 11:53:00-06:00 (ss time local)\n2023-03-04 17:53:00+00:00 (ss time UTC)\n2023-03-05 02:21:00-06:00 (timer time local)\n2023-03-05 08:21:00+00:00 (timer time UTC)\n", | |
"output_type": "stream" | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": "ticket_dt = local_tz.localize(datetime.datetime(2023, 3, 5, 2, 22))\nticket_delta = ticket_dt - timer_dt\nprint(f'{ticket_delta} <- Difference between what Og expects and reality')\nprint(f'{int(ticket_delta.total_seconds()):7d} <- reality incongruence in seconds')\nprint(f'{datetime.timedelta(hours=2)} <- amount of time probably wasted')", | |
"metadata": { | |
"trusted": true | |
}, | |
"execution_count": 5, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"text": "0:01:00 <- Difference between what Og expects and reality\n 60 <- reality incongruence in seconds\n2:00:00 <- amount of time probably wasted\n", | |
"output_type": "stream" | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment