Skip to content

Commit

Permalink
datetime: Make datetime.now() work by defaulting to UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
stinos committed Oct 24, 2023
1 parent 9e00444 commit 5787f6d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions python-stdlib/datetime/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,10 +633,9 @@ def fromtimestamp(cls, ts, tz=None):
else:
us = 0
if tz is None:
raise NotImplementedError
else:
dt = cls(*_tmod.gmtime(ts)[:6], microsecond=us, tzinfo=tz)
dt = tz.fromutc(dt)
tz = timezone.utc
dt = cls(*_tmod.gmtime(ts)[:6], microsecond=us, tzinfo=tz)
dt = tz.fromutc(dt)
return dt

@classmethod
Expand Down

0 comments on commit 5787f6d

Please sign in to comment.