mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 00:03:45 +08:00
timed: set valid flag (#32061)
* timed: set valid flag * oops old-commit-hash: 43832335b8e44e40683ffe6afa226a2d2de0d6ff
This commit is contained in:
+11
-2
@@ -1,6 +1,15 @@
|
||||
import datetime
|
||||
from pathlib import Path
|
||||
|
||||
MIN_DATE = datetime.datetime(year=2024, month=1, day=28)
|
||||
_MIN_DATE = datetime.datetime(year=2024, month=3, day=30)
|
||||
|
||||
def min_date():
|
||||
# on systemd systems, the default time is the systemd build time
|
||||
systemd_path = Path("/lib/systemd/systemd")
|
||||
if systemd_path.exists():
|
||||
d = datetime.datetime.fromtimestamp(systemd_path.stat().st_mtime)
|
||||
return d + datetime.timedelta(days=1)
|
||||
return _MIN_DATE
|
||||
|
||||
def system_time_valid():
|
||||
return datetime.datetime.now() > MIN_DATE
|
||||
return datetime.datetime.now() > min_date()
|
||||
|
||||
Reference in New Issue
Block a user