Akihiro Sagawa : ucrtbase: Asctime() uses space-padding for day of month as seen in C89.

Alexandre Julliard julliard at winehq.org
Tue Mar 13 17:10:52 CDT 2018


Module: wine
Branch: master
Commit: f4ddd3190adb2b9a30d51693cce7262091ad3d66
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f4ddd3190adb2b9a30d51693cce7262091ad3d66

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Sun Mar 11 22:14:24 2018 +0900

ucrtbase: Asctime() uses space-padding for day of month as seen in C89.

Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/time.c         | 7 +++++++
 dlls/ucrtbase/tests/misc.c | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c
index b7b76af..a2500c4 100644
--- a/dlls/msvcrt/time.c
+++ b/dlls/msvcrt/time.c
@@ -1349,9 +1349,16 @@ static char* asctime_buf(char *buf, const struct MSVCRT_tm *mstm)
         return NULL;
     }
 
+#if _MSVCR_VER>=140
+    /* C89 (4.12.3.1) uses space-padding for day of month. */
+    MSVCRT__snprintf(buf, 26, "%s %s %2d %02d:%02d:%02d %c%03d\n", wday[mstm->tm_wday],
+            month[mstm->tm_mon], mstm->tm_mday, mstm->tm_hour, mstm->tm_min,
+            mstm->tm_sec, '1'+(mstm->tm_year+900)/1000, (900+mstm->tm_year)%1000);
+#else
     MSVCRT__snprintf(buf, 26, "%s %s %02d %02d:%02d:%02d %c%03d\n", wday[mstm->tm_wday],
             month[mstm->tm_mon], mstm->tm_mday, mstm->tm_hour, mstm->tm_min,
             mstm->tm_sec, '1'+(mstm->tm_year+900)/1000, (900+mstm->tm_year)%1000);
+#endif
     return buf;
 }
 
diff --git a/dlls/ucrtbase/tests/misc.c b/dlls/ucrtbase/tests/misc.c
index 4a95910..2bb221b 100644
--- a/dlls/ucrtbase/tests/misc.c
+++ b/dlls/ucrtbase/tests/misc.c
@@ -762,7 +762,7 @@ static void test_asctime(void)
     }
 
     ret = p_asctime(&epoch);
-    todo_wine ok(!strcmp(ret, "Thu Jan  1 00:00:00 1970\n"), "asctime returned %s\n", ret);
+    ok(!strcmp(ret, "Thu Jan  1 00:00:00 1970\n"), "asctime returned %s\n", ret);
 }
 
 START_TEST(misc)




More information about the wine-cvs mailing list