xref: /netbsd-src/lib/libc/time/offtime.3 (revision 274254cdae52594c1aa480a736aef78313d15c9c)
1.\"	$NetBSD: offtime.3,v 1.1 2004/05/10 02:02:00 kleink Exp $
2.\" Written by Klaus Klein, May 10, 2004.
3.\" Public domain.
4.Dd May 10, 2004
5.Dt OFFTIME 3
6.Os
7.Sh NAME
8.Nm offtime ,
9.Nm timeoff ,
10.Nm timegm ,
11.Nm timelocal
12.Nd convert date and time
13.Sh LIBRARY
14.Lb libc
15.Sh SYNOPSIS
16.In time.h
17.Ft struct tm *
18.Fn offtime "const time_t * clock" "long int offset"
19.Ft time_t
20.Fn timeoff "struct tm * tm" "long int offset"
21.Ft time_t
22.Fn timegm "struct tm * tm"
23.Ft time_t
24.Fn timelocal "struct tm * tm"
25.Sh DESCRIPTION
26These functions are inspired by C standard interfaces named similarly.
27.Pp
28.Fn offtime
29converts the calendar time
30.Fa clock ,
31offset by
32.Fa offset
33seconds,
34into broken-down time, expressed as Coordinated Universal Time (UTC).
35.Pp
36.Fn timeoff
37converts the broken-down time
38.Fa tm ,
39expressed as UTC,
40offset by
41.Fa offset
42seconds,
43into a calendar time value.
44.Pp
45.Fn timegm
46converts the broken-down time
47.Fa tm
48into a calendar time value, effectively being the inverse of
49.Xr gmtime 3 .
50It is equivalent to the C standard function
51.Xr mktime 3
52operating in UTC.
53.Pp
54.Fn timelocal
55converts the broken down time
56.Fa tm ,
57expressed as local time, into a calendar time value.
58It is equivalent to the C standard function
59.Xr mktime 3 ,
60and is provided for symmetry only.
61.Sh SEE ALSO
62.Xr ctime 3 ,
63.Xr tzset 3
64