Skip to content

Instantly share code, notes, and snippets.

@lotka
Last active July 6, 2017 10:44
Show Gist options
  • Save lotka/e7bdaa098bca88b03bcaccf4513666a7 to your computer and use it in GitHub Desktop.
Save lotka/e7bdaa098bca88b03bcaccf4513666a7 to your computer and use it in GitHub Desktop.
timewaste
from time import time, sleep, ctime
from os import system
import sys
total = 0.0
working = True
def t():
return float(time())/60.0
print 'You are working'
start = t()
while True:
a = t()
sys.stdin.read(1)
b = t()
nicetime = ctime()
if working:
dif = float(b - a)
system('clear')
print '{0} \nYou worked: {1}'.format(nicetime,int(dif))
print '####################################'
time_since_start = float(b - start)
total += dif
print 'Total work = {0}, total time = {1}, '.format(round(total,2),round(time_since_start,2))
print 'Work ratio = {0}'.format(round(total/time_since_start,2))
print 'You are wasting time'
else:
system('clear')
#print '{0} \nYou are working!'.format(nicetime)
print '####################################'
print '####################################'
print '####################################'
print '####################################'
print '####################################'
working = not working
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment