diff options
| author | Nick Pope <nick@nickpope.me.uk> | 2021-05-07 10:42:59 +0100 |
|---|---|---|
| committer | Carlton Gibson <carlton.gibson@noumenal.es> | 2021-05-12 11:08:41 +0200 |
| commit | d06c5b358149c02a62da8a5469264d05f29ac659 (patch) | |
| tree | 2ca0d6884062980dea5e8085af0868f9d9b5a266 /django/utils/version.py | |
| parent | 69ffb1acf38bd34f76707468bb592eb4b164e2da (diff) | |
Fixed #32366 -- Updated datetime module usage to recommended approach.
- Replaced datetime.utcnow() with datetime.now().
- Replaced datetime.utcfromtimestamp() with datetime.fromtimestamp().
- Replaced datetime.utctimetuple() with datetime.timetuple().
- Replaced calendar.timegm() and datetime.utctimetuple() with datetime.timestamp().
Diffstat (limited to 'django/utils/version.py')
| -rw-r--r-- | django/utils/version.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/utils/version.py b/django/utils/version.py index 18cd1387a0..a72d3202fa 100644 --- a/django/utils/version.py +++ b/django/utils/version.py @@ -89,8 +89,9 @@ def get_git_changeset(): shell=True, cwd=repo_dir, universal_newlines=True, ) timestamp = git_log.stdout + tz = datetime.timezone.utc try: - timestamp = datetime.datetime.utcfromtimestamp(int(timestamp)) + timestamp = datetime.datetime.fromtimestamp(int(timestamp), tz=tz) except ValueError: return None return timestamp.strftime('%Y%m%d%H%M%S') |
