1
This commit is contained in:
parent
4af43d5649
commit
dfefdc732a
@ -2,14 +2,24 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import binascii
|
||||
import time
|
||||
import datetime
|
||||
|
||||
def xPrint(text):
|
||||
print(text, flush=True)
|
||||
|
||||
def getDaySeconds(time_val, incdays):
|
||||
def getDaySeconds(time_val, incdays = 0):
|
||||
time_zone = 8
|
||||
return int((time_val + time_zone * 3600)/3600/24 + incdays) * 3600 * 24 - 3600 * time_zone;
|
||||
|
||||
def getMondaySeconds(time_val):
|
||||
dt_val = datetime.datetime.fromtimestamp(time_val)
|
||||
day = dt_val.weekday()
|
||||
if day == 0:
|
||||
return getDaySeconds(time_val - (3600 * 24 * 6))
|
||||
else:
|
||||
return getDaySeconds(time_val - (3600 * 24 * (day - 1)))
|
||||
|
||||
def crc32(data):
|
||||
hash_code = binascii.crc32(data)
|
||||
assert hash_code >= 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user