https://bugs.winehq.org/show_bug.cgi?id=47809
Bug ID: 47809 Summary: mscrt: strftime is missing some substutions Product: Wine Version: unspecified Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: msvcrt Assignee: wine-bugs@winehq.org Reporter: chuck.the.pc.guy+winehq@gmail.com Distribution: ---
I realize that I am using a non-standard config to report this bug, but please read it all the way through.
I first realized this issue when installing a few Lua addons into Elder Scrolls Online (run via Proton because that's the only way I can get it work).
In the process I found that a couple of addons I had added were crashing. After verifying that the issue does not appear in Windows under the same circumstances I opted to have a look.
After a little digging I found that these crashes were due to addon calls to Lua os.date. I dug through the Lua code and found that os.date calls strftime for its results.
The addons that were giving me issues were LibDateTime and LibDebugLogger, which begin their failure due to the following calls:
LibDateTime: os.date("%V", timestamp) LibDebugLogger: os.date("%F %T.%%03.0f %z", timestamp / 1000)
After looking at the code in msvcrt (linked to by crtdll) I can see that there is no implementation of the %V token (which gives the first error). I did fix the second error by using the 3-token substitutions of %F and %T, but I had to substitute both (%F simply isn't implemented, but even expanding %F and leaving %T -- which is implemented -- didn't work either) to get it working.
Cross-referencing the Microsoft docs about the substitutions, I ran across the following missing substitutions:
%C - Century, year dividied by 100 and truncated to integer %D - Same as %m/%d/%y %e - Day of month as decimal, with leaded space if requried %F - Same as %Y-%m-%d %g - Two-digit ISO 8601 week-based year %G - ISO 8601 week-based year %h - Same as %b %n - newline character %R - Same as %H:%M %r - Locale's 12-hour clock time %t - horizontal tab %u - ISO 8601 week day %V - ISO 8601 week number
I'm not sure if %T is working correctly, so I'll have to find some way to test that.
Reference: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wc...