-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathTiming.py
More file actions
35 lines (29 loc) · 794 Bytes
/
Timing.py
File metadata and controls
35 lines (29 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'''
每天定时更新数据库,使其打卡记录置为0
'''
import datetime, platform, time
from UserManage import *
def run_Task():
os_platform = platform.platform()
if os_platform.startswith('Window'):
update_Data()
elif os_platform.startswith('Darwin'):
update_Data()
def update_Data():
dbHelper = DBHelper()
sql = "update record set success=0"
result = dbHelper.execute(sql, None)
if result:
print('更新成功')
else:
print('更新失败')
time.sleep(60)
def timerRun(h, m):
while True:
while True:
now = datetime.datetime.now()
if now.hour == h and now.minute == m:
break
time.sleep(20)
run_Task()
print('已更新数据库...')