Skip to content

Fix commit time timezones#2

Open
mrkeuz wants to merge 1 commit into
pypingou:masterfrom
mrkeuz:fix_time_zone
Open

Fix commit time timezones#2
mrkeuz wants to merge 1 commit into
pypingou:masterfrom
mrkeuz:fix_time_zone

Conversation

@mrkeuz

@mrkeuz mrkeuz commented Feb 2, 2021

Copy link
Copy Markdown

Currently, commit time set as UTC time. So here fix for this.

@mrkeuz mrkeuz changed the title Fix commit time for expect timezones Fix commit time timezones Feb 3, 2021
@pypingou

pypingou commented Feb 9, 2021

Copy link
Copy Markdown
Owner

It was very much by design committing in UTC, is that causing problem?

@mrkeuz

mrkeuz commented Feb 9, 2021

Copy link
Copy Markdown
Author

I'm not faced with some problems. But it little confused that you commit just now, but git log show you date corrected by timezone offset.

I.e. my time zone +03:00, but after commit git log shows that commit taken three hours ago.

So currently commit date is just wrong.

Edit:
If I understand correctly datetime.utcnow() return datetime object without tz info and so treated as local time (see docs below). If timezone i.e. +03:00 you get datetime object pointed to now - tz offset.

As well as datetime treated as local, and it pointed to datetime with some offset in result you get wrong timestamp.

See: https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants