mirror of
https://github.com/cc65/cc65.git
synced 2025-08-08 22:25:28 +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:
@@ -67,7 +67,6 @@ size_t __fastcall__ strftime (char* buf, size_t bufsize, const char* format,
|
|||||||
char c;
|
char c;
|
||||||
char arg[40];
|
char arg[40];
|
||||||
const char* argptr;
|
const char* argptr;
|
||||||
unsigned week;
|
|
||||||
|
|
||||||
/* Copy until we reach the end of the format string or a format specifier */
|
/* Copy until we reach the end of the format string or a format specifier */
|
||||||
count = 0;
|
count = 0;
|
||||||
@@ -132,20 +131,12 @@ size_t __fastcall__ strftime (char* buf, size_t bufsize, const char* format,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'U':
|
case 'U':
|
||||||
week = tm->tm_yday / 7;
|
sprintf (arg, "%02d", (tm->tm_yday + 7 - tm->tm_wday) / 7);
|
||||||
if (tm->tm_mday % 7 > tm->tm_wday) {
|
|
||||||
++week;
|
|
||||||
}
|
|
||||||
sprintf (arg, "%02u", week);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'W':
|
case 'W':
|
||||||
/* ### This one is buggy */
|
sprintf (arg, "%02d",
|
||||||
week = tm->tm_yday / 7;
|
(tm->tm_yday + 7 - (tm->tm_wday? tm->tm_wday - 1 : 6)) / 7);
|
||||||
if (tm->tm_mday % 7 > tm->tm_wday) {
|
|
||||||
++week;
|
|
||||||
}
|
|
||||||
sprintf (arg, "%2u", week);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'X':
|
case 'X':
|
||||||
|
Reference in New Issue
Block a user