removing gettimeofday in mktime that would cause nested call
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2331 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
fd96a07a24
commit
7f2731c666
|
@ -83,7 +83,7 @@ struct tm* localtime(const time_t* t)
|
||||||
return localtime_r(t, &tmp);
|
return localtime_r(t, &tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t timegm(struct tm * const t)
|
time_t mktime(struct tm * const t)
|
||||||
{
|
{
|
||||||
register time_t day;
|
register time_t day;
|
||||||
register time_t i;
|
register time_t i;
|
||||||
|
@ -157,16 +157,6 @@ time_t timegm(struct tm * const t)
|
||||||
return ((day + t->tm_hour) * i + t->tm_min) * i + t->tm_sec;
|
return ((day + t->tm_hour) * i + t->tm_min) * i + t->tm_sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t mktime(register struct tm* const t)
|
|
||||||
{
|
|
||||||
time_t x = timegm(t);
|
|
||||||
struct timezone tz = {0};
|
|
||||||
gettimeofday(0, &tz);
|
|
||||||
timezone = tz.tz_minuteswest * 60L;
|
|
||||||
x += timezone;
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void num2str(char *c, int i)
|
static void num2str(char *c, int i)
|
||||||
{
|
{
|
||||||
c[0] = i / 10 + '0';
|
c[0] = i / 10 + '0';
|
||||||
|
|
Loading…
Reference in New Issue