Stub out the subsecond decimals.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52719 Signed-off-by: Francois Gouget fgouget@codeweavers.com --- GetTimeFormatEx() does not support formatting fractions of a second. So just stub that out until there is a need for it. At least now echo %time% can be used to see where a batch file spends its time. --- programs/cmd/tests/test_builtins.cmd.exp | 2 +- programs/cmd/wcmdmain.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index 15fda131a5c..9075b4e3246 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -1223,7 +1223,7 @@ CD value @pwd@@or_broken@CD value@space@ @todo_wine@Match @todo_wine@Has %errorlevel% @todo_wine@Has %time% -@todo_wine@%time% has seconds +%time% has seconds @todo_wine@%time% has 1/100s End of %time% @todo_wine@Match diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index af54b209d83..318e8e6e454 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -621,8 +621,12 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR startchar) NULL, thisVarContents, MAXSTRING); len = lstrlenW(thisVarContents); } else if (WCMD_is_magic_envvar(thisVar, L"TIME")) { - GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, + GetTimeFormatW(LOCALE_USER_DEFAULT, 0, NULL, NULL, thisVarContents, MAXSTRING); + /* FIXME This should have 1/100s precision and a localized decimal + * separator. */ + if (*thisVarContents == '0') *thisVarContents = ' '; + lstrcatW(thisVarContents, L".00"); len = lstrlenW(thisVarContents); } else if (WCMD_is_magic_envvar(thisVar, L"CD")) { GetCurrentDirectoryW(MAXSTRING, thisVarContents);