ctime now working?
This commit is contained in:
parent
5828a0363f
commit
d2af261477
@ -313,7 +313,7 @@ class BackupRotator:
|
|||||||
best_ctime = None
|
best_ctime = None
|
||||||
for item in items:
|
for item in items:
|
||||||
|
|
||||||
ctime = self._detect_item_date(config, item)
|
ctime = self._detect_item_creation_date(config, item)
|
||||||
if best_ctime is None or ctime < best_ctime:
|
if best_ctime is None or ctime < best_ctime:
|
||||||
best_ctime = ctime
|
best_ctime = ctime
|
||||||
best_item = item
|
best_item = item
|
||||||
@ -324,11 +324,11 @@ class BackupRotator:
|
|||||||
return best_item, best_ctime, age_seconds, age_string
|
return best_item, best_ctime, age_seconds, age_string
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _detect_item_date(config: ConfigFile, item: Path) -> datetime.datetime:
|
def _detect_item_creation_date(config: ConfigFile, item: Path) -> datetime.datetime:
|
||||||
|
|
||||||
if config.date_detection == "file":
|
if config.date_detection == "file":
|
||||||
ctime = datetime.datetime.fromtimestamp(
|
ctime = datetime.datetime.fromtimestamp(
|
||||||
item.stat().st_ctime, tz=datetime.timezone.utc
|
item.stat().st_ctime
|
||||||
)
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -342,7 +342,7 @@ class BackupRotator:
|
|||||||
|
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
|
|
||||||
ctime = self._detect_item_date(config=config, item=item)
|
ctime = self._detect_item_creation_date(config=config, item=item)
|
||||||
delta = now - ctime.now()
|
delta = now - ctime.now()
|
||||||
|
|
||||||
return delta.seconds
|
return delta.seconds
|
||||||
|
Loading…
Reference in New Issue
Block a user