Skip to content

Instantly share code, notes, and snippets.

@pifantastic
Created October 23, 2009 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pifantastic/216981 to your computer and use it in GitHub Desktop.
Save pifantastic/216981 to your computer and use it in GitHub Desktop.
def time_left(self):
if self.completed:
return 0
start = int(time.mktime(self.starttime.timetuple()))
now = int(time.mktime(datetime.datetime.now().timetuple()))
time_left = start + (settings.ATTACK_DURATION * 60) - now
if time_left > 0:
return time_left
else:
return 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment