Hello,
Running Cygwin 3.1.7-1 on Windows 10 Version 21H1 (OS Build 19043.985),
I have this issue:
when I start Cygwin's Python, I have correct time reported:
mikek@DESKTOP-8SHAE9Q ~
$ python
Python 3.8.9 (default, Apr 21 2021, 23:14:29)
[GCC 10.2.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.now()
datetime.datetime(2021, 6, 7, 9, 40, 15, 318391)
But running Python for Windows (it doesn't matter which, specifically
for the test I used the one from MS Store [1]), I have incorrect local time:
mikek@DESKTOP-8SHAE9Q ~
$ "C:/Program
Files/WindowsApps/PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0/python3.8.exe"
Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC
v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.now()
datetime.datetime(2021, 6, 7, 7, 40, 55, 503775)
Note how the latter output reports 2021-06-07 07:40, while the former
reports 2021-06-07 09:40. The difference is 2 hours.
Starting the same Python for Windows from cmd.exe has it correct:
C:\Users\mikek>python
Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC
v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.now()
datetime.datetime(2021, 6, 7, 9, 41, 21, 925240)
Cygwin reports correct timezone:
$ echo $TZ
Europe/Moscow
Starting Python for Windows using a different timezone (specifically, '$
TZ=UTC "C:/Program
Files/WindowsApps/PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0/python3.8.exe"')
gives correct time for *that* time zone.
This is a problem, because in our project (LibreOffice), we use Cygwin
as environment for unit testing, where LibreOffice's own Python (also
built natively for Windows) is used, and at some times (from 00:00 till
02:00) it reports wrong dates, which makes tests fail locally on
affected systems(see [2]).
Thank you!
[1] https://www.microsoft.com/en-us/p/python-38/9mssztt1n39l
[2]
https://gerrit.libreoffice.org/c/core/+/92217/2#message-f55091795e7cde9d75adc00ddb69451121b644f6
--
Best regards,
Mike Kaganski
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple