Mail Archives: cygwin/1997/01/29/09:48:22
On Tue, 28 Jan 1997 16:20:37 -1000 (HST), Tim Newsham
<newsham AT aloha DOT net> wrote:
> When using strftime() I am getting some missing fields. In
>particular:
>
> strftime(buf, 50, "%d %h %Y %T GMT", gmtime(&t));
>
>gives me a buffer: "25 1994 GMT" with missing "%h" and "%T", and
>
> strftime(buf, 50, "%a %b %d %H:%M:%S %Z %Y", localtime(&t));
>
>gives me a buffer: "Sun Dec 25 17:00:00 1994" with missing "%Z".
This is due to the (wrong, IMHO) choice to use DOS strftime flags rather
than the Unix ones. The DOS flags are as follows (from VC++):
%a Abbreviated weekday name
%A Full weekday name
%b Abbreviated month name
%B Full month name
%c Date and time representation appropriate for the locale
%d Day of the month as a decimal number (01 - 31)
%H Hour in 24-hour format (00 - 23)
%I Hour in 12-hour format (01 - 12)
%j Day of the year as a decimal number (001 - 366)
%m Month as a decimal number (01 - 12)
%M Minute as a decimal number (00 - 59)
%p Current locale's A.M./P.M. indicator for a 12-hour clock
%S Second as a decimal number (00 - 59)
%U Week of the year as a decimal number, with Sunday as the first day of
the week (00 - 51)
%w Weekday as a decimal number (0 - 6; Sunday is 0)
%W Week of the year as a decimal number, with Monday as the first day of
the week (00 - 51)
%x Date representation for current locale
%X Time representation for current locale
%y Year without the century as a decimal number (00 - 99)
%Y Year with the century as a decimal number
%z Time zone name or abbreviation; no characters if time zone is unknown
%% Percent sign
You'll probably need to #ifdef __CYGWIN32__ the strftimes and use the
DOS codes.
--
James Dumser 972-462-5335 dumser AT ti DOT com
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -