msys2.github.io icon indicating copy to clipboard operation
msys2.github.io copied to clipboard

The time is 7 hours difference in msys2 and windows term

Open maryjeck opened this issue 3 years ago • 5 comments

windows cmd below

C:\Users\xxxxxx>python3
 Python 3.10.6 (main, Aug 12 2022, 18:00:29)  [GCC 12.1.0 64 bit (AMD64)] on win32
 Type "help", "copyright", "credits" or "license" for more information.
 >>> from datetime import datetime
 >>> datetime.now()
 datetime.datetime(2022, 9, 12, 11, 21, 4, 285171)
 >>>

msys2 below

# xxxxxx @ xxxxxx-computer in ~ [11:19:28]
$ python3
Python 3.10.6 (main, Aug 12 2022, 18:00:29)  [GCC 12.1.0 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> datetime.now()
datetime.datetime(2022, 9, 12, 4, 19, 54, 709405)
>>>

There is run just in the sametime

what is happed?

maryjeck avatar Sep 12 '22 03:09 maryjeck

I can not reproduce the issue in my system. Try to check if your system time and timezone is correct.

Biswa96 avatar Sep 12 '22 03:09 Biswa96

in msys2 ,i use this ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

maryjeck avatar Sep 12 '22 03:09 maryjeck

I use ZSH for msys2.

when I restart msys2 ,I type zsh again, that is OK, no time difference .

I don't know what's happed?

Who can tell me why?

maryjeck avatar Sep 12 '22 14:09 maryjeck

I found the reason。 In my env , "python3" is set "alias python3='/usr/bin/winpty python3'"

When I use "/mingw64/bin/python3" ,that is OK.

so , Does the "winpty" has some config that we don't understand/?

maryjeck avatar Sep 15 '22 01:09 maryjeck

winpty is just like simple pipe. It should not modify time.

Biswa96 avatar Sep 15 '22 02:09 Biswa96