Mercurial > hg > octave-nkf > gnulib-hg
annotate lib/timegm.c @ 17935:0ad1f4c9eed5 default tip
tests: support stderr verification with returns_()
* tests/init.sh (returns_): Disable tracing for this wrapper
function, so that stderr of the wrapped command is unchanged,
allowing for verification of the contents.
author | Pádraig Brady <P@draigBrady.com> |
---|---|
date | Mon, 16 Feb 2015 17:20:39 +0000 (2015-02-16) |
parents | ab58d4870664 |
children |
rev | line source |
---|---|
4621
3d28ad4e18e2
Add time_r module. Change timegm, mktime, and strftime to use localtime_r
Paul Eggert <eggert@cs.ucla.edu>
parents:
4616
diff
changeset
|
1 /* Convert UTC calendar time to simple time. Like mktime but assumes UTC. |
3d28ad4e18e2
Add time_r module. Change timegm, mktime, and strftime to use localtime_r
Paul Eggert <eggert@cs.ucla.edu>
parents:
4616
diff
changeset
|
2 |
17848 | 3 Copyright (C) 1994, 1997, 2003-2004, 2006-2007, 2009-2015 Free Software |
7302
8a1a9361108c
* _fpending.c: Include <config.h> unconditionally, since we no
Paul Eggert <eggert@cs.ucla.edu>
parents:
5848
diff
changeset
|
4 Foundation, Inc. This file is part of the GNU C Library. |
4616 | 5 |
6 This program is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
8 the Free Software Foundation; either version 2, or (at your option) | |
9 any later version. | |
10 | |
11 This program is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
16366
bb182ee4a09d
maint: replace FSF snail-mail addresses with URLs
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
17 along with this program; if not, see <http://www.gnu.org/licenses/>. */ |
4616 | 18 |
8146
b31580167c2b
New module 'time', so that apps can include <time.h> as per
Paul Eggert <eggert@cs.ucla.edu>
parents:
7302
diff
changeset
|
19 #ifndef _LIBC |
7302
8a1a9361108c
* _fpending.c: Include <config.h> unconditionally, since we no
Paul Eggert <eggert@cs.ucla.edu>
parents:
5848
diff
changeset
|
20 # include <config.h> |
8146
b31580167c2b
New module 'time', so that apps can include <time.h> as per
Paul Eggert <eggert@cs.ucla.edu>
parents:
7302
diff
changeset
|
21 #endif |
b31580167c2b
New module 'time', so that apps can include <time.h> as per
Paul Eggert <eggert@cs.ucla.edu>
parents:
7302
diff
changeset
|
22 |
b31580167c2b
New module 'time', so that apps can include <time.h> as per
Paul Eggert <eggert@cs.ucla.edu>
parents:
7302
diff
changeset
|
23 #include <time.h> |
b31580167c2b
New module 'time', so that apps can include <time.h> as per
Paul Eggert <eggert@cs.ucla.edu>
parents:
7302
diff
changeset
|
24 |
b31580167c2b
New module 'time', so that apps can include <time.h> as per
Paul Eggert <eggert@cs.ucla.edu>
parents:
7302
diff
changeset
|
25 #ifndef _LIBC |
4621
3d28ad4e18e2
Add time_r module. Change timegm, mktime, and strftime to use localtime_r
Paul Eggert <eggert@cs.ucla.edu>
parents:
4616
diff
changeset
|
26 # undef __gmtime_r |
3d28ad4e18e2
Add time_r module. Change timegm, mktime, and strftime to use localtime_r
Paul Eggert <eggert@cs.ucla.edu>
parents:
4616
diff
changeset
|
27 # define __gmtime_r gmtime_r |
4931
3743557233a8
(__mktime_internal) [!_LIBC]: Define to mktime_internal
Jim Meyering <jim@meyering.net>
parents:
4621
diff
changeset
|
28 # define __mktime_internal mktime_internal |
12228
465038ef6bc4
mktime, timegm: share common declaration
Eric Blake <ebb9@byu.net>
parents:
8146
diff
changeset
|
29 # include "mktime-internal.h" |
4621
3d28ad4e18e2
Add time_r module. Change timegm, mktime, and strftime to use localtime_r
Paul Eggert <eggert@cs.ucla.edu>
parents:
4616
diff
changeset
|
30 #endif |
4616 | 31 |
32 time_t | |
4621
3d28ad4e18e2
Add time_r module. Change timegm, mktime, and strftime to use localtime_r
Paul Eggert <eggert@cs.ucla.edu>
parents:
4616
diff
changeset
|
33 timegm (struct tm *tmp) |
4616 | 34 { |
4621
3d28ad4e18e2
Add time_r module. Change timegm, mktime, and strftime to use localtime_r
Paul Eggert <eggert@cs.ucla.edu>
parents:
4616
diff
changeset
|
35 static time_t gmtime_offset; |
3d28ad4e18e2
Add time_r module. Change timegm, mktime, and strftime to use localtime_r
Paul Eggert <eggert@cs.ucla.edu>
parents:
4616
diff
changeset
|
36 tmp->tm_isdst = 0; |
3d28ad4e18e2
Add time_r module. Change timegm, mktime, and strftime to use localtime_r
Paul Eggert <eggert@cs.ucla.edu>
parents:
4616
diff
changeset
|
37 return __mktime_internal (tmp, __gmtime_r, &gmtime_offset); |
4616 | 38 } |