| 1 |
/* Convert a `struct tm' to a time_t value. |
/* Convert a `struct tm' to a time_t value. |
| 2 |
Copyright (C) 1993-1999, 2002-2004, 2005 Free Software Foundation, Inc. |
Copyright (C) 1993-1999, 2002-2004, 2005, 2006 Free Software Foundation, Inc. |
| 3 |
This file is part of the GNU C Library. |
This file is part of the GNU C Library. |
| 4 |
Contributed by Paul Eggert (eggert@twinsun.com). |
Contributed by Paul Eggert (eggert@twinsun.com). |
| 5 |
|
|
| 215 |
/* Overflow occurred one way or another. Return the nearest result |
/* Overflow occurred one way or another. Return the nearest result |
| 216 |
that is actually in range, except don't report a zero difference |
that is actually in range, except don't report a zero difference |
| 217 |
if the actual difference is nonzero, as that would cause a false |
if the actual difference is nonzero, as that would cause a false |
| 218 |
match. */ |
match; and don't oscillate between two values, as that would |
| 219 |
|
confuse the spring-forward gap detector. */ |
| 220 |
return (*t < TIME_T_MIDPOINT |
return (*t < TIME_T_MIDPOINT |
| 221 |
? TIME_T_MIN + (*t == TIME_T_MIN) |
? (*t <= TIME_T_MIN + 1 ? *t + 1 : TIME_T_MIN) |
| 222 |
: TIME_T_MAX - (*t == TIME_T_MAX)); |
: (TIME_T_MAX - 1 <= *t ? *t - 1 : TIME_T_MAX)); |
| 223 |
} |
} |
| 224 |
|
|
| 225 |
/* Use CONVERT to convert *T to a broken down time in *TP. |
/* Use CONVERT to convert *T to a broken down time in *TP. |