.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/lib/libc/stdtime/strptime.3,v 1.24 2005/01/20 09:17:04 ru Exp $
+.\" $FreeBSD$
.\" "
-.Dd January 4, 2003
+.Dd October 2, 2014
.Dt STRPTIME 3
.Os
.Sh NAME
.In time.h
.Ft char *
.Fo strptime
-.Fa "const char *restrict buf"
-.Fa "const char *restrict format"
-.Fa "struct tm *restrict tm"
+.Fa "const char * restrict buf"
+.Fa "const char * restrict format"
+.Fa "struct tm * restrict timeptr"
.Fc
.In time.h
.In xlocale.h
.Ft char *
-.Fo strptime_l
-.Fa "const char *restrict buf"
-.Fa "const char *restrict format"
-.Fa "struct tm *restrict tm"
-.Fa "locale_t loc"
-.Fc
+.Fn strptime_l "const char * restrict buf" "const char * restrict format" "struct tm * restrict timeptr" "locale_t loc"
.Sh DESCRIPTION
The
.Fn strptime
function parses the string in the buffer
-.Fa buf ,
+.Fa buf
according to the string pointed to by
.Fa format ,
and fills in the elements of the structure pointed to by
-.Fa tm .
+.Fa timeptr .
The resulting values will be relative to the local time zone.
Thus, it can be considered the reverse operation of
.Xr strftime 3 .
+The
+.Fn strptime_l
+function does the same as
+.Fn strptime ,
+but takes an explicit locale rather than using the current locale.
.Pp
The
.Fa format
are now interpreted as beginning at 1969 per POSIX requirements.
Years 69-00 are interpreted in the 20th century (1969-2000), years
01-68 in the 21st century (2001-2068).
+The
+.Fa \&%U
+and
+.Fa %W
+format specifiers accept any value within the range 00 to 53.
.Pp
If the
.Fa format
specify the resulting
.Vt struct tm ,
the unspecified members of
-.Va tm
+.Va timeptr
are left untouched.
For example, if
.Fa format
.Va tm_min
will be modified.
If time relative to today is desired, initialize the
-.Fa tm
+.Fa timeptr
structure with today's date before passing it to
.Fn strptime .
-.Pp
-While the
-.Fn strptime
-function uses the current locale, the
-.Fn strptime_l
-function may be passed a locale directly. See
-.Xr xlocale 3
-for more information.
.Sh RETURN VALUES
Upon successful completion,
.Fn strptime
It returns
.Dv NULL
if one of the conversions failed.
+.Fn strptime_l
+returns the same values as
+.Fn strptime .
.Sh LEGACY DESCRIPTION
In legacy mode, the
.Fa %Y
is taken as noon.
.Pp
The
-.Fa %U
-and
-.Fa %W
-format specifiers accept any value within the range 00 to 53
-without validating against other values supplied (like month
-or day of the year, for example).
-.Pp
-The
.Fa %Z
format specifier only accepts time zone abbreviations of the local time zone,
or the value "GMT".