xref: /minix3/lib/libc/time/offtime.3 (revision f14fb602092e015ff630df58e17c2a9cd57d29b3)
1.\"	$NetBSD: offtime.3,v 1.3 2011/04/14 05:50:50 jruoho Exp $
2.\" Written by Klaus Klein, May 10, 2004.
3.\" Public domain.
4.Dd April 14, 2011
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 struct tm *
20.Fn offtime_r "const time_t * clock" "long int offset" "struct tm *ret"
21.Ft time_t
22.Fn timeoff "struct tm * tm" "long int offset"
23.Ft time_t
24.Fn timegm "struct tm * tm"
25.Ft time_t
26.Fn timelocal "struct tm * tm"
27.Sh DESCRIPTION
28These functions are inspired by C standard interfaces named similarly.
29.Pp
30.Fn offtime
31converts the calendar time
32.Fa clock ,
33offset by
34.Fa offset
35seconds,
36into broken-down time, expressed as Coordinated Universal Time (UTC).
37.Pp
38.Fn offtime_r
39is similar to
40.Fn offtime
41but it places the returned
42.Ft "struct tm *"
43in the user supplied
44.Fa ret
45argument.
46.Pp
47.Fn timeoff
48converts the broken-down time
49.Fa tm ,
50expressed as UTC,
51offset by
52.Fa offset
53seconds,
54into a calendar time value.
55.Pp
56.Fn timegm
57converts the broken-down time
58.Fa tm
59into a calendar time value, effectively being the inverse of
60.Xr gmtime 3 .
61It is equivalent to the C standard function
62.Xr mktime 3
63operating in UTC.
64.Pp
65.Fn timelocal
66converts the broken down time
67.Fa tm ,
68expressed as local time, into a calendar time value.
69It is equivalent to the C standard function
70.Xr mktime 3 ,
71and is provided for symmetry only.
72.Sh SEE ALSO
73.Xr ctime 3 ,
74.Xr tm 3 ,
75.Xr tzset 3
76