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 Free Software Foundation, Inc. |
Copyright (C) 1993-1999, 2002, 2003 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 |
|
|
264 |
|
|
265 |
int sec_requested = sec; |
int sec_requested = sec; |
266 |
|
|
|
/* Only years after 1970 are defined. |
|
|
If year is 69, it might still be representable due to |
|
|
timezone differences. */ |
|
|
if (year < 69) |
|
|
return -1; |
|
|
|
|
267 |
#if LEAP_SECONDS_POSSIBLE |
#if LEAP_SECONDS_POSSIBLE |
268 |
/* Handle out-of-range seconds specially, |
/* Handle out-of-range seconds specially, |
269 |
since ydhms_tm_diff assumes every minute has 60 seconds. */ |
since ydhms_tm_diff assumes every minute has 60 seconds. */ |
371 |
return -1; |
return -1; |
372 |
} |
} |
373 |
|
|
|
if (year == 69) |
|
|
{ |
|
|
/* If year was 69, need to check whether the time was representable |
|
|
or not. */ |
|
|
if (t < 0 || t > 2 * 24 * 60 * 60) |
|
|
return -1; |
|
|
} |
|
|
|
|
374 |
*tp = tm; |
*tp = tm; |
375 |
return t; |
return t; |
376 |
} |
} |