2023-09-27 15:45:31 -07:00
|
|
|
import datetime
|
2024-06-11 01:36:40 +00:00
|
|
|
from pathlib import Path
|
2023-09-27 15:45:31 -07:00
|
|
|
|
2025-03-08 09:09:31 +00:00
|
|
|
MIN_DATE = datetime.datetime(year=2025, month=2, day=21)
|
2024-06-11 01:36:40 +00:00
|
|
|
|
|
|
|
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)
|
2025-03-08 09:09:31 +00:00
|
|
|
return max(MIN_DATE, d + datetime.timedelta(days=1))
|
|
|
|
return MIN_DATE
|
2023-09-27 15:45:31 -07:00
|
|
|
|
|
|
|
def system_time_valid():
|
2024-06-11 01:36:40 +00:00
|
|
|
return datetime.datetime.now() > min_date()
|