Last active
August 4, 2023 14:05
-
-
Save komidore64/73c49a99a04377d8c7114c6fd6f36af3 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
#!/usr/bin/env python3 | |
from datetime import datetime, timedelta | |
class BeatTime(): | |
def __init__(self): | |
# Swatch Internet Time uses the time scale of Biel Meantime (BMT), | |
# which is equivalent to UTC+1. | |
bmt_now = datetime.utcnow() + timedelta(hours=1) | |
# Swatch Internet Time is calculated by dividing the number of seconds | |
# past midnight by the number of seconds contained within one .beat. | |
self.beat_time = (bmt_now.second + (bmt_now.minute * 60) + (bmt_now.hour * 60 * 60)) / 86.4 | |
def __str__(self): | |
return "@{:.1f}".format(self.beat_time) | |
print(BeatTime()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment