Skip to content

Commit

Permalink
make creation_date timezone-aware
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
amorison committed Sep 27, 2024
1 parent f8a8a04 commit f399066
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ford/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f399066

Please sign in to comment.