Skip to content

Commit b9ebd8c

Browse files
author
Lucas Gameiro
authored
convert to UTC time always (#551)
1 parent 2c0f64b commit b9ebd8c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backups.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import re
1111
import shutil
1212
import tempfile
13-
from datetime import datetime
13+
from datetime import datetime, timezone
1414
from pathlib import Path
1515
from subprocess import PIPE, TimeoutExpired, run
1616
from typing import Dict, List, Optional, OrderedDict, Tuple
@@ -405,7 +405,9 @@ def _generate_backup_list_output(self) -> str:
405405
backup_reference, _ = self._parse_backup_id(backup["reference"][-1])
406406
lsn_start_stop = f'{backup["lsn"]["start"]} / {backup["lsn"]["stop"]}'
407407
time_start, time_stop = (
408-
datetime.strftime(datetime.fromtimestamp(stamp), "%Y-%m-%dT%H:%M:%SZ")
408+
datetime.strftime(
409+
datetime.fromtimestamp(stamp, timezone.utc), "%Y-%m-%dT%H:%M:%SZ"
410+
)
409411
for stamp in backup["timestamp"].values()
410412
)
411413
backup_path = f'/{self.stanza_name}/{backup["label"]}'

0 commit comments

Comments
 (0)