Skip to content

Commit

Permalink
Extend the timer code to make it a bit more useful in some cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsitton committed Sep 12, 2015
1 parent 5dbb441 commit 83ef4bc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fofix/core/timer.py
Expand Up @@ -36,14 +36,18 @@
class Timer(object):
def __init__(self):

self.currentTime = self.previousTime = self.time()
self.startTime = self.currentTime = self.previousTime = self.time()

self.tickDelta = 0

def time(self):
''' Get current time in milliseconds '''
return timeFunc() * 1000

def delta_time(self):
'''Return time delta since startTime'''
return self.time() - self.startTime

def tick(self):
''' Returns the delta between the current and previous ticks '''

Expand Down

0 comments on commit 83ef4bc

Please sign in to comment.