https://bugs.winehq.org/show_bug.cgi?id=52719
Bug ID: 52719 Summary: cmd.exe mishandles echo %time% Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: cmd Assignee: wine-bugs@winehq.org Reporter: fgouget@codeweavers.com Distribution: ---
Created attachment 72080 --> https://bugs.winehq.org/attachment.cgi?id=72080 Check the date /t, %date%, time /t, %time% output
I was hoping to sprinkle some echo %time% in the test_builtins.cmd script to figure out where it was spending time. But unfortunately in Wine all I get is:
c:> echo %time% 19:10
Whereas on Windows from XP to 21H1 I get:
c:> echo %time% 19:10:05.34
Fixing Wine to get the time with second resolution is easy, just drop TIME_NOSECONDS from the GetTimeFormatW() call. But that call does not seem to support returning subsecond data. Yet %time% is localized (with a French system locale it uses a comma as the decimal separator).
Also Wine mishandles date /t and time /t, particularly the latter since it does not use the same format as plain "time".
For reference here is the output of the attached test patch:
English =======
C:\Users\Public\Documents>date The current date is: Wed 03/23/2022 Enter the new date: (mm-dd-yy) C:\Users\Public\Documents>date /T Wed 03/23/2022
C:\Users\Public\Documents>echo Wed 03/23/2022 <---- %date% Wed 03/23/2022
C:\Users\Public\Documents>time The current time is: 11:53:01.13 Enter the new time: C:\Users\Public\Documents>time /T 11:53 AM
C:\Users\Public\Documents>echo 11:53:01.13 <---- %time% 11:53:01.13
French ======
C:\Users\Public\Documents>date La date du jour est�: 23/03/2022 Entrez la nouvelle date�: (jj-mm-aa) C:\Users\Public\Documents>date /T 23/03/2022
C:\Users\Public\Documents>echo 23/03/2022 <--- %date% 23/03/2022
C:\Users\Public\Documents>time L'heure actuelle est�: 20:23:28,60 Entrez la nouvelle heure�: C:\Users\Public\Documents>time /T 20:23
C:\Users\Public\Documents>echo 20:23:28,60 <--- %time% 20:23:28,60