Mail Archives: djgpp/2000/12/26/18:37:04
On Sun, 24 Dec 2000, Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
> On Sat, 23 Dec 2000, Jason Green wrote:
>
> > > But C99 defines about a dozen more conversion specifiers which aren't
> > > supported by DJGPP right now. It would be nice to add them as well.
> >
> > I agree, but this all takes time. If %z is fixed now shouldn't it go
> > in?
>
> I didn't say it shouldn't. But fixing %z alone doesn't sound like a big
> win to me.
Well I started this by trying to fix one user's problem... :-/
AFAICT, the good news is that DJGPP is not far from compliant already
(if you conveniently ignore locales).
Apart from support for locales, the missing/changed functionality
seems straight forward to implement. The only one I really have a
problem with is calculating ISO week numbers.
> Also, the docs needs to be amended to describe %z.
--- src/libc/ansi/time/strftime.txh.orig Mon Aug 2 12:28:18 1999
+++ src/libc/ansi/time/strftime.txh Sun Dec 24 11:01:52 2000
@@ -149,6 +149,10 @@
The timezone abbreviation (@code{EDT})
+@item %z
+
+The time-zone as hour offset from UTC (@code{-0500})
+
@item %%
A percent symbol (@code{%})
> > BTW, if I fill a struct tm with values for 0/Jan/YYYY, then call
> > mktime(), it should be modified to 31/Dec/(YYYY-1), right? This isn't
> > happening.
>
> Please post a complete example.
The program below prints:
Mon, 00 Jan 2001
Unless I am mistaken, it should print:
Sun, 31 Dec 2000
#include <stdio.h>
#include <time.h>
#include <string.h>
int main(void)
{
char str[80];
struct tm tm;
memset(&tm, 0, sizeof(tm));
tm.tm_mday = 0;
tm.tm_mon = 0;
tm.tm_year = 101;
mktime(&tm);
strftime(str, sizeof(str), "%a, %d %b %Y", &tm);
puts(str);
return 0;
}
- Raw text -