-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
12 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
# pip install pywin32 | ||
import win32api,datetime,time, random | ||
import win32api,time,random | ||
|
||
# set the time to be: | ||
# current time + n minutes | ||
def bump(n): | ||
d = datetime.datetime.now() | ||
minute = d.minute | ||
d = time.gmtime() | ||
minute = d.tm_min | ||
if minute < 60-n: | ||
minute += n | ||
# else we have to bump the hour, and | ||
# if hour is close to midnight, bump | ||
# the day, and the month and etc.. so | ||
# up to minute 60-n is good enough | ||
|
||
win32api.SetSystemTime( | ||
d.year, | ||
d.month, | ||
d.weekday(), | ||
d.day, | ||
d.hour, | ||
d.tm_year, | ||
d.tm_mon, | ||
d.tm_wday, | ||
d.tm_mday, | ||
d.tm_hour, | ||
minute, | ||
d.second, | ||
d.tm_sec, | ||
0) | ||
|
||
while True: | ||
# sleep between 10 and 20 minutes | ||
time.sleep(600,1200) | ||
|
||
# bump between 1 and 5 minutes | ||
bump(random.randint(1,5)) | ||
|
||
time.sleep(600) |