Skip to content

Conversation

@mrkeuz
Copy link

@mrkeuz mrkeuz commented Feb 2, 2021

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
Copy link
Owner

pypingou commented Feb 9, 2021

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

@mrkeuz
Copy link
Author

mrkeuz commented Feb 9, 2021

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