OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man3 / getdate.3
index d87e1f0..5da786c 100644 (file)
@@ -2,6 +2,7 @@
 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
 .\"     <mtk.manpages@gmail.com>
 .\"
+.\" %%%LICENSE_START(VERBATIM)
 .\" Permission is granted to make and distribute verbatim copies of this
 .\" manual provided the copyright notice and this permission notice are
 .\" preserved on all copies.
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
 .\"
 .\" Modified, 2001-12-26, aeb
 .\" 2008-09-07, mtk, Various rewrites; added an example program.
 .\"
-.TH GETDATE 3 2008-09-07 "" "Linux Programmer's Manual"
+.TH GETDATE 3 2014-06-13 "" "Linux Programmer's Manual"
 .SH NAME
 getdate, getdate_r \- convert a date-plus-time string to broken-down time
 .SH SYNOPSIS
-.B "#define _XOPEN_SOURCE 500"
-.br
 .B "#include <time.h>"
 .sp
 .BI "struct tm *getdate(const char *" string );
 .sp
 .B "extern int getdate_err;"
 .sp
-.B "#define _GNU_SOURCE"
-.br
 .B "#include <time.h>"
 .sp
 .BI "int getdate_r(const char *" string ", struct tm *" res );
+.sp
+.in -4n
+Feature Test Macro Requirements for glibc (see
+.BR feature_test_macros (7)):
+.in
+.sp
+.BR getdate ():
+.ad l
+.RS 4
+_XOPEN_SOURCE\ >=\ 500 ||
+_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
+.RE
+.br
+.BR getdate_r ():
+.ad l
+.RS 4
+_GNU_SOURCE
+.RE
+.ad
 .SH DESCRIPTION
 The function
 .BR getdate ()
@@ -92,7 +109,8 @@ Otherwise, the structure is initialized to the broken-down time
 corresponding to the current local time (as by a call to
 .BR localtime (3)).
 .LP
-When only the weekday is given, the day is taken to be the first such day
+When only the day of the week is given,
+the day is taken to be the first such day
 on or after today.
 .LP
 When only the month is given (and no year), the month is taken to
@@ -114,7 +132,7 @@ it returns errors via the function result value,
 and returns the resulting broken-down time in the
 caller-allocated buffer pointed to by the argument
 .IR res .
-.SH "RETURN VALUE"
+.SH RETURN VALUE
 When successful,
 .BR getdate ()
 returns a pointer to a
@@ -175,7 +193,16 @@ File containing format patterns.
 .BR TZ ", " LC_TIME
 Variables used by
 .BR strptime (3).
-.SH "CONFORMING TO"
+.SH ATTRIBUTES
+.SS Multithreading (see pthreads(7))
+The
+.BR getdate ()
+function is not thread-safe.
+.LP
+The
+.BR getdate_r ()
+function is thread-safe.
+.SH CONFORMING TO
 POSIX.1-2001.
 .SH NOTES
 The POSIX.1-2001 specification for
@@ -203,7 +230,7 @@ The following shell session demonstrates the operation of the program:
 .in +4n
 .nf
 .RB "$" " TFILE=$PWD/tfile"
-.RB "$" " echo \(aq%A\(aq > $TFILE " "      # Full weekday name"
+.RB "$" " echo \(aq%A\(aq > $TFILE " "      # Full name of the day of the week"
 .RB "$" " echo \(aq%T\(aq >> $TFILE" "      # ISO date (YYYY-MM-DD)"
 .RB "$" " echo \(aq%F\(aq >> $TFILE" "      # Time (HH:MM:SS)"
 .RB "$" " date"
@@ -245,7 +272,7 @@ Call 3 ("12:22:33") succeeded:
 .SS Program source
 \&
 .nf
-#define _GNU_SOURCE 500
+#define _GNU_SOURCE
 #include <time.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -280,10 +307,18 @@ main(int argc, char *argv[])
     exit(EXIT_SUCCESS);
 }
 .fi
-.SH "SEE ALSO"
+.SH SEE ALSO
 .BR time (2),
 .BR localtime (3),
 .BR setlocale (3),
 .BR strftime (3),
-.BR strptime (3),
-.BR feature_test_macros (7)
+.BR strptime (3)
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.