1timegm(3)                  Library Functions Manual                  timegm(3)
2
3
4

NAME

6       timegm, timelocal - inverses of gmtime and localtime
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <time.h>
13
14       [[deprecated]] time_t timelocal(struct tm *tm);
15       time_t timegm(struct tm *tm);
16
17   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
18
19       timelocal(), timegm():
20           Since glibc 2.19:
21               _DEFAULT_SOURCE
22           glibc 2.19 and earlier:
23               _BSD_SOURCE || _SVID_SOURCE
24

DESCRIPTION

26       The functions timelocal() and timegm() are the inverses of localtime(3)
27       and gmtime(3).  Both functions take a broken-down time and  convert  it
28       to  calendar  time (seconds since the Epoch, 1970-01-01 00:00:00 +0000,
29       UTC).  The difference between the two  functions  is  that  timelocal()
30       takes  the local timezone into account when doing the conversion, while
31       timegm() takes the input value to be Coordinated Universal Time (UTC).
32

RETURN VALUE

34       On success, these functions return the calendar time (seconds since the
35       Epoch), expressed as a value of type time_t.  On error, they return the
36       value (time_t) -1 and set errno to indicate the error.
37

ERRORS

39       EOVERFLOW
40              The result cannot be represented.
41

ATTRIBUTES

43       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
44       tributes(7).
45
46       ┌─────────────────────────────────┬───────────────┬────────────────────┐
47Interface                        Attribute     Value              
48       ├─────────────────────────────────┼───────────────┼────────────────────┤
49timelocal(), timegm()            │ Thread safety │ MT-Safe env locale │
50       └─────────────────────────────────┴───────────────┴────────────────────┘
51

STANDARDS

53       BSD.
54

HISTORY

56       GNU, BSD.
57
58       The  timelocal()  function is equivalent to the POSIX standard function
59       mktime(3).  There is no reason to ever use it.
60

SEE ALSO

62       gmtime(3), localtime(3), mktime(3), tzset(3)
63
64
65
66Linux man-pages 6.05              2023-07-20                         timegm(3)
Impressum