Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/time/mktime.c')
-rw-r--r--newlib/libc/time/mktime.c56
1 files changed, 1 insertions, 55 deletions
diff --git a/newlib/libc/time/mktime.c b/newlib/libc/time/mktime.c
index 0ee055cd0..80478dae9 100644
--- a/newlib/libc/time/mktime.c
+++ b/newlib/libc/time/mktime.c
@@ -47,7 +47,6 @@ ANSI C requires <<mktime>>.
#include <stdlib.h>
#include <time.h>
-#include "local.h"
#define _SEC_IN_MINUTE 60L
#define _SEC_IN_HOUR 3600L
@@ -157,8 +156,7 @@ mktime (tim_p)
{
time_t tim = 0;
long days = 0;
- int year, isdst;
- __tzinfo_type *tz = __gettzinfo ();
+ int year;
/* validate structure */
validate_structure (tim_p);
@@ -202,57 +200,5 @@ mktime (tim_p)
/* compute total seconds */
tim += (days * _SEC_IN_DAY);
- isdst = tim_p->tm_isdst;
-
- if (_daylight)
- {
- int y = tim_p->tm_year + YEAR_BASE;
- if (y == tz->__tzyear || __tzcalc_limits (y))
- {
- /* calculate start of dst in dst local time and
- start of std in both std local time and dst local time */
- time_t startdst_dst = tz->__tzrule[0].change
- - (time_t) tz->__tzrule[1].offset;
- time_t startstd_dst = tz->__tzrule[1].change
- - (time_t) tz->__tzrule[1].offset;
- time_t startstd_std = tz->__tzrule[1].change
- - (time_t) tz->__tzrule[0].offset;
- /* if the time is in the overlap between dst and std local times */
- if (tim >= startstd_std && tim < startstd_dst)
- ; /* we let user decide or leave as -1 */
- else
- {
- isdst = (tz->__tznorth
- ? (tim >= startdst_dst && tim < startstd_std)
- : (tim >= startdst_dst || tim < startstd_std));
- /* if user committed and was wrong, perform correction */
- if ((isdst ^ tim_p->tm_isdst) == 1)
- {
- /* we either subtract or add the difference between
- time zone offsets, depending on which way the user got it
- wrong. The diff is typically one hour, or 3600 seconds,
- and should fit in a 16-bit int, even though offset
- is a long to accomodate 12 hours. */
- int diff = (int) (tz->__tzrule[0].offset
- - tz->__tzrule[1].offset);
- if (!isdst)
- diff = -diff;
- tim_p->tm_sec += diff;
- validate_structure (tim_p);
- tim += diff; /* we also need to correct our current time calculation */
- }
- }
- }
- }
-
- /* add appropriate offset to put time in gmt format */
- if (isdst == 1)
- tim += (time_t) tz->__tzrule[1].offset;
- else /* otherwise assume std time */
- tim += (time_t) tz->__tzrule[0].offset;
-
- /* reset isdst flag to what we have calculated */
- tim_p->tm_isdst = isdst;
-
return tim;
}