tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: strftime(3) oddities with %s, %z



>> I don't think that's needed for what uwe@ and dholland@ were looking
>> for, which -- if I understand correctly -- is that:

>| 	gmtime_r(&t, &gtm);
>| 	localtime_r(&t, &ltm);
>| 	strftime_XXX(gbuf, sizeof(gbuf), "... %s ...", &gtm);
>| 	strftime_XXX(lbuf, sizeof(lbuf), "... %s ...", &ltm);

>| should format the same number at %s in the output

> That simply isn't possible, or not and retain [compatibility with
> existing and apparently-soon-to-be-codified practice].

Which is why I, and I think at least one or two of the others (though
in very different words), have been calling the existing API broken: it
cannot do the naïvely-obvious thing, a perfectly reasonable thing from
a conceptual point of view, a thing which I suspect is what would be
expected by someone who deosn't understand enough details to know just
how Byzantinely broken this is.  Before reading this thread, I would
have expected something like the above to work.  (Probably because I
haven't tried to use struct tm for timezone-aware code and thus haven't
run into this trainwreck before.)

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index