From f399066837470161b292602783b985c08a5d0b5c Mon Sep 17 00:00:00 2001 From: Adrien Morison Date: Fri, 27 Sep 2024 14:07:30 +0100 Subject: [PATCH] make creation_date timezone-aware `datetime.now()` returns a naive timestamp in the local TZ. When formatting this timestamp, `%z` and `%Z` directives would therefore always be empty. This commit calls `.astimezone()` to attach the system TZ to this timestamp. `%z` and `%Z` directives when formatting the timestamp are now respected. --- ford/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ford/__init__.py b/ford/__init__.py index 86775bff..d3e01e55 100755 --- a/ford/__init__.py +++ b/ford/__init__.py @@ -342,7 +342,7 @@ def parse_arguments( proj_data.normalise_paths(directory) - proj_data.creation_date = datetime.now().strftime(proj_data.creation_date) + proj_data.creation_date = datetime.now().astimezone().strftime(proj_data.creation_date) # Make sure no src_dir is contained within output_dir for srcdir in proj_data.src_dir: