Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jackdoe committed Oct 5, 2023
1 parent 095dfd7 commit 3f1c2d3
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions projects/panic/cards/change_time.py
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)

0 comments on commit 3f1c2d3

Please sign in to comment.