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-01-29 09:09:58 +00:00
|
|
|
_MIN_DATE = datetime.datetime(year=2024, month=8, day=26)
|
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)
|
|
|
|
return 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()
|