diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2001-09-13 20:40:49 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2001-09-13 20:40:49 +0000 |
commit | 6342caa4e633abbbd5d8ddac58e637341b4d57fb (patch) | |
tree | 281c0293b153ecd0e4735375d9ff7a343db9f9f3 /newlib | |
parent | 3900c377d8d9235617544f22f0da59bd0abd2714 (diff) | |
download | newlib-6342caa4e633abbbd5d8ddac58e637341b4d57fb.zip newlib-6342caa4e633abbbd5d8ddac58e637341b4d57fb.tar.gz newlib-6342caa4e633abbbd5d8ddac58e637341b4d57fb.tar.bz2 |
Thu Sep 13 08:49:49 2001 Jason Tishler <jason@tishler.net>
* strftime.c (strftime): Fix "%W" implementation to properly handle
Mondays too.
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/ChangeLog | 5 | ||||
-rw-r--r-- | newlib/libc/time/strftime.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 3e8d67c..3216856 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +Thu Sep 13 08:49:49 2001 Jason Tishler <jason@tishler.net> + + * strftime.c (strftime): Fix "%W" implementation to properly handle + Mondays too. + 2001-09-07 Jeff Law <law@redhat.com> * libc/sys/h8300hms/crt0.S: For H8/300H and H8/S, load address of diff --git a/newlib/libc/time/strftime.c b/newlib/libc/time/strftime.c index 1e6154f..1b44e1d 100644 --- a/newlib/libc/time/strftime.c +++ b/newlib/libc/time/strftime.c @@ -362,9 +362,10 @@ _DEFUN (strftime, (s, maxsize, format, tim_p), case 'W': if (count < maxsize - 2) { + int wday = (tim_p->tm_wday) ? tim_p->tm_wday - 1 : 6; sprintf (&s[count], "%2.2d", - (tim_p->tm_yday + ((8 - - tim_p->tm_wday) % 7)) / 7); + (tim_p->tm_yday + 7 - + wday) / 7); count += 2; } else |