mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-05 00:05:59 +08:00
Replace usages of datetime.now() with datetime.utcnow() (#1267)
This commit is contained in:
@@ -523,7 +523,7 @@ def main():
|
||||
("LongitudinalControl", "0"),
|
||||
("LimitSetSpeed", "0"),
|
||||
("LimitSetSpeedNeural", "0"),
|
||||
("LastUpdateTime", datetime.datetime.now().isoformat().encode('utf8')),
|
||||
("LastUpdateTime", datetime.datetime.utcnow().isoformat().encode('utf8')),
|
||||
("OpenpilotEnabledToggle", "1"),
|
||||
("LaneChangeEnabled", "1"),
|
||||
]
|
||||
|
||||
@@ -261,7 +261,7 @@ def thermald_thread():
|
||||
# **** starting logic ****
|
||||
|
||||
# Check for last update time and display alerts if needed
|
||||
now = datetime.datetime.now()
|
||||
now = datetime.datetime.utcnow()
|
||||
|
||||
# show invalid date/time alert
|
||||
time_valid = now.year >= 2019
|
||||
|
||||
@@ -112,7 +112,7 @@ def set_consistent_flag():
|
||||
def set_update_available_params(new_version=False):
|
||||
params = Params()
|
||||
|
||||
t = datetime.datetime.now().isoformat()
|
||||
t = datetime.datetime.utcnow().isoformat()
|
||||
params.put("LastUpdateTime", t.encode('utf8'))
|
||||
|
||||
if new_version:
|
||||
@@ -314,7 +314,7 @@ def main():
|
||||
|
||||
while True:
|
||||
update_failed_count += 1
|
||||
time_wrong = datetime.datetime.now().year < 2019
|
||||
time_wrong = datetime.datetime.utcnow().year < 2019
|
||||
ping_failed = subprocess.call(["ping", "-W", "4", "-c", "1", "8.8.8.8"])
|
||||
|
||||
# Wait until we have a valid datetime to initialize the overlay
|
||||
|
||||
Reference in New Issue
Block a user