strftime.3: Move 822-compliant date format example to EXAMPLES section

The RFC 822-compliant date format given in the description
of `%z' is now moved to the `EXAMPLES' section (note: `EXAMPLE'
has been renamed `EXAMPLES').

Furthermore, that format example is now actually
RFC 822-compliant (using `%y' instead of `%Y') and has been
qualified as being correct only when in the context of at least
an English locale. Also, `%T' is used in place of `%H:%M:%S'.

For completeness, an RFC 2822-compliant format example has been
similarly added.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Witten 2010-01-17 05:28:13 +01:00 committed by Michael Kerrisk
parent db74fcddde
commit a0c811713d
1 changed files with 18 additions and 7 deletions

View File

@ -250,9 +250,7 @@ The
.I +hhmm
or
.I -hhmm
numeric timezone (that is, the hour and minute offset from UTC).
Required to emit RFC\ 822-conformant dates
(using "%a,\ %d\ %b\ %Y\ %H:%M:%S\ %z"). (SU)
numeric timezone (that is, the hour and minute offset from UTC). (SU)
.TP
.B %Z
The timezone or name or abbreviation.
@ -449,7 +447,19 @@ Nowadays,
.BR gcc (1)
provides the \fI\-Wno\-format\-y2k\fP option to prevent the warning,
so that the above workaround is no longer required.
.SH EXAMPLE
.SH EXAMPLES
.BR "RFC\ 2822-compliant date format"
(with an English locale for %a and %b)
.PP
.in +2n
"%a,\ %d\ %b\ %Y\ %T\ %z"
.PP
.BR "RFC\ 822-compliant date format"
(with an English locale for %a and %b)
.PP
.in +2n
"%a,\ %d\ %b\ %y\ %T\ %z"
.SS Example Program
The program below can be used to experiment with
.BR strftime ().
.PP
@ -467,9 +477,10 @@ Result string is "00011"
Result string is " 11"
.fi
.in
.SS Program source
\&
.PP
Here's the program source:
.nf
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
@ -495,7 +506,7 @@ main(int argc, char *argv[])
printf("Result string is \\"%s\\"\\n", outstr);
exit(EXIT_SUCCESS);
} /* main */
}
.fi
.SH "SEE ALSO"
.BR date (1),