fix: publish collection history atomically
This commit is contained in:
@@ -25,11 +25,14 @@ def detect_system_tz() -> str:
|
||||
|
||||
localtime = Path("/etc/localtime")
|
||||
if localtime.is_symlink():
|
||||
target = os.readlink(str(localtime))
|
||||
# Strip common prefixes: /usr/share/zoneinfo/, /usr/lib/zoneinfo/
|
||||
for prefix in ("/usr/share/zoneinfo/", "/usr/lib/zoneinfo/"):
|
||||
if target.startswith(prefix):
|
||||
return target[len(prefix):]
|
||||
target_path = Path(os.readlink(str(localtime)))
|
||||
if not target_path.is_absolute():
|
||||
target_path = localtime.parent / target_path
|
||||
target = target_path.resolve().as_posix()
|
||||
marker = "/zoneinfo/"
|
||||
marker_index = target.find(marker)
|
||||
if marker_index >= 0:
|
||||
return target[marker_index + len(marker):]
|
||||
return target
|
||||
|
||||
return "UTC"
|
||||
|
||||
Reference in New Issue
Block a user