speed up things a bit by disabling sleeptimer
[enigma2.git] / tests / fake_time.py
1 import time
2
3 real_time = None
4 time_offset = 0
5
6 def setRealtime():
7         global real_time
8         real_time = time.time
9
10 def setIdealtime():
11         global real_time
12         real_time = lambda: 0
13
14 def setTime(now):
15         global time_offset
16         time_offset = real_time() - now
17
18 setIdealtime()
19 setTime(0)
20
21 def my_time():
22         return real_time() - time_offset
23
24 time.time = my_time
25
26 def my_sleep(sleep):
27         global time_offset
28         time_offset -= sleep
29         print "(faking %f seconds)" % sleep
30
31 time.sleep = my_sleep