mirror of https://github.com/mkerrisk/man-pages
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:
parent
db74fcddde
commit
a0c811713d
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue