-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimeService.py
More file actions
22 lines (19 loc) · 811 Bytes
/
TimeService.py
File metadata and controls
22 lines (19 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import time
import sys
class TimeService:
def __init__(self, scaleFactor):
self.scaleFactor = scaleFactor
# initlize the clock, each subsquent call will return the seconds
# scense this call
self.initialTime = time.clock()
sys.stdout.write("TimeService.Init: " + str(self.initialTime) + "\n")
sys.stdout.write("TimeService.scaleFactor: " + str(self.scaleFactor) + "\n")
def CurrentTime(self):
# get seconds from start
# multiply seconds by scale factor
# add scaled seconds to start to get scalled time
# return it
actualSeconds = time.clock() - self.initialTime
return (actualSeconds * self.scaleFactor) * 10
def ResetTime(self):
self.initialTime = time.clock()