xref: /freebsd/lib/libc/stdtime/strptime.3 (revision a8445737e740901f5f2c8d24c12ef7fc8b00134e)
1.\"
2.\" Copyright (c) 1997 Joerg Wunsch
3.\"
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
16.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25.\"
26.\" $Id: strptime.3,v 1.1 1997/08/09 15:43:54 joerg Exp $
27.\" "
28.Dd May 8, 1997
29.Dt STRPTIME 3
30.Os
31.Sh NAME
32.Nm strptime
33.Nd parse date and time string
34.Sh SYNOPSIS
35.Fd #include <time.h>
36.Ft char *
37.Fn strptime "const char *buf" "const char *format" "struct tm *timeptr"
38.Sh DESCRIPTION
39The
40.Fn strptime
41function parses the string in the buffer
42.Fa buf
43according to the string pointed to by
44.Fa format ,
45and fills in the elements of the structure pointed to by
46.Fa timeptr .
47Thus, it can be considered the reverse operation of
48.Xr strftime 3 .
49.Pp
50The
51.Fa format
52string consists of zero or more conversion specifications and
53ordinary characters.
54All ordinary characters are matched exactly with the buffer, where
55white space in the format string will match any amount of white space
56in the buffer.
57All conversion specifications are identical to those described in
58.Xr strftime 3 .
59.Sh RETURN VALUES
60Upon successful completion,
61.Fn strptime
62returns the pointer to the first character in
63.Fa buf
64that has not been required to satisfy the specified conversions in
65.Fa format .
66It returns
67.Dv NULL
68if one of the conversions failed.
69.Sh SEE ALSO
70.Xr date 1 ,
71.Xr scanf 3 ,
72.Xr strftime 3
73.Sh AUTHORS
74The
75.Fn strptime
76function has been contributed by Powerdog Industries.
77.Pp
78This man page was written by
79.ie t J\(:org Wunsch.
80.el Joerg Wunsch.
81.Sh HISTORY
82The
83.Fn strptime
84function appeared in
85.Fx 3.0 .
86