Skip to content

Instantly share code, notes, and snippets.

@rfc1459
Created April 4, 2011 21:33
Show Gist options
  • Save rfc1459/902485 to your computer and use it in GitHub Desktop.
Save rfc1459/902485 to your computer and use it in GitHub Desktop.
In L'Aquila we're still waiting for Apr 7 00:00:00 2009...
#!/usr/bin/env python
# In L'Aquila we're still waiting for Apr 7 00:00:00 2009...
import time
__all__ = ['eternal_april']
_APRIL_MIDNIGHT = 1238968800.0
def eternal_april(ts=None):
assert ts >= _APRIL_MIDNIGHT or ts is None, "Negative time delta"
if ts is None:
ts = time.time()
days = int((ts - _APRIL_MIDNIGHT) / (60.0**2))
ltime = time.localtime(ts)
return time.strftime("Mon Apr 6 %d:%%M:%%S CEST 2009" % days, ltime)
if __name__ == '__main__':
print eternal_april()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment