Last active
December 15, 2021 22:15
-
-
Save NewProggie/e75f37388ea541402f1cdf6db18322af to your computer and use it in GitHub Desktop.
Convert date bezel to time
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
# Small utility to help me set the correct time on my Swatch watch reference: | |
# Sistem51 Hodinkee Stoplight Neon Remix watch | |
from math import floor, trunc | |
def frac(n): | |
return n - floor(n) | |
for idx in range(1, 32): | |
dec_time = 60 / 31. * idx | |
minute = trunc(dec_time) | |
seconds = round(frac(dec_time) * 60) | |
print("%2d: %2d minutes, %2d seconds" % (idx, minute, seconds)) | |
## Output ## | |
# 1: 1 minutes, 56 seconds | |
# 2: 3 minutes, 52 seconds | |
# 3: 5 minutes, 48 seconds | |
# 4: 7 minutes, 45 seconds | |
# 5: 9 minutes, 41 seconds | |
# 6: 11 minutes, 37 seconds | |
# 7: 13 minutes, 33 seconds | |
# 8: 15 minutes, 29 seconds | |
# 9: 17 minutes, 25 seconds | |
# 10: 19 minutes, 21 seconds | |
# 11: 21 minutes, 17 seconds | |
# 12: 23 minutes, 14 seconds | |
# 13: 25 minutes, 10 seconds | |
# 14: 27 minutes, 6 seconds | |
# 15: 29 minutes, 2 seconds | |
# 16: 30 minutes, 58 seconds | |
# 17: 32 minutes, 54 seconds | |
# 18: 34 minutes, 50 seconds | |
# 19: 36 minutes, 46 seconds | |
# 20: 38 minutes, 43 seconds | |
# 21: 40 minutes, 39 seconds | |
# 22: 42 minutes, 35 seconds | |
# 23: 44 minutes, 31 seconds | |
# 24: 46 minutes, 27 seconds | |
# 25: 48 minutes, 23 seconds | |
# 26: 50 minutes, 19 seconds | |
# 27: 52 minutes, 15 seconds | |
# 28: 54 minutes, 12 seconds | |
# 29: 56 minutes, 8 seconds | |
# 30: 58 minutes, 4 seconds | |
# 31: 60 minutes, 0 seconds | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment