Skip to content

Instantly share code, notes, and snippets.

Created December 12, 2012 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/4267849 to your computer and use it in GitHub Desktop.
Save anonymous/4267849 to your computer and use it in GitHub Desktop.
xmas market invitation in Python
# -*- coding: utf-8 -*-
#
# frwd to other interested parties at the institute
#
import datetime
import time
leave_at = datetime.datetime(2012,12,13,12,00)
while True:
delta = leave_at - datetime.datetime.now()
if abs(delta.seconds) < 120:
raise SystemExit, u"Immediately leave for *xmas market Esslingen*, " +\
u"12:14 S-Bahn UNIVERSITÄT, 13th Dec. 2012"
elif delta.seconds > 0:
hh = delta.seconds / 3600
mm = (delta.seconds % 3600) / 60
ss = delta.seconds % 60
print("Leave for *xmas market Esslingen* in %dh %dm %ds" %
(hh, mm, ss))
else:
raise ValueError, "Too late, you missed joining us!"
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment