1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-27 12:29:33 +00:00

Fixed %W/%U

git-svn-id: svn://svn.cc65.org/cc65/trunk@1517 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2002-11-13 18:08:36 +00:00
parent fccf00aa14
commit 1407208c4c

View File

@ -67,7 +67,6 @@ size_t __fastcall__ strftime (char* buf, size_t bufsize, const char* format,
char c;
char arg[40];
const char* argptr;
unsigned week;
/* Copy until we reach the end of the format string or a format specifier */
count = 0;
@ -132,20 +131,12 @@ size_t __fastcall__ strftime (char* buf, size_t bufsize, const char* format,
break;
case 'U':
week = tm->tm_yday / 7;
if (tm->tm_mday % 7 > tm->tm_wday) {
++week;
}
sprintf (arg, "%02u", week);
sprintf (arg, "%02d", (tm->tm_yday + 7 - tm->tm_wday) / 7);
break;
case 'W':
/* ### This one is buggy */
week = tm->tm_yday / 7;
if (tm->tm_mday % 7 > tm->tm_wday) {
++week;
}
sprintf (arg, "%2u", week);
sprintf (arg, "%02d",
(tm->tm_yday + 7 - (tm->tm_wday? tm->tm_wday - 1 : 6)) / 7);
break;
case 'X':