Skip to content

Instantly share code, notes, and snippets.

@djmitche
Last active March 13, 2017 20:17
Show Gist options
  • Save djmitche/10403772746d29ee47b9dd308f06399b to your computer and use it in GitHub Desktop.
Save djmitche/10403772746d29ee47b9dd308f06399b to your computer and use it in GitHub Desktop.
import time
PHASE = 11 * 24 * 3600 + 7 * 3600 + 45 * 60
now = int(time.time())
next = now - (now % PHASE) + PHASE
print("phase: {} days {} hours {} minutes".format(PHASE / (3600*24), PHASE % (3600*24) / 3600, PHASE % 3600 / 60))
def time_is_link(when):
return time.strftime(
'https://time.is/%I00%P_%d_%b_%Y_in_UTC/PT/ET/Berlin/India/New_Zealand/Dubai/Tokyo?Reading_by_Moonlight',
time.gmtime(when))
for x in range(10):
when = next + x * PHASE
# round down to the nearest hour
when = when - (when % 3600)
print("* [{} {} UTC] - (no topic)".format(
time_is_link(when),
time.asctime(time.gmtime(when))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment