fix
This commit is contained in:
parent
6f119ef4d0
commit
223ae4cc7e
|
@ -33,7 +33,6 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
//#define TM_YEAR_BASE 1970 //origin
|
//#define TM_YEAR_BASE 1970 //origin
|
||||||
#define TM_YEAR_BASE 1900 // slguan
|
#define TM_YEAR_BASE 1900 // slguan
|
||||||
#define _MAX__TIME64_T 0x793406fffi64
|
|
||||||
|
|
||||||
// This magic number is the number of 100 nanosecond intervals since January 1, 1601 (UTC)
|
// This magic number is the number of 100 nanosecond intervals since January 1, 1601 (UTC)
|
||||||
// until 00:00:00 January 1, 1970
|
// until 00:00:00 January 1, 1970
|
||||||
|
@ -419,7 +418,9 @@ struct tm *taosLocalTime(const time_t *timep, struct tm *result) {
|
||||||
LARGE_INTEGER offset;
|
LARGE_INTEGER offset;
|
||||||
struct tm tm1;
|
struct tm tm1;
|
||||||
time_t tt = 0;
|
time_t tt = 0;
|
||||||
localtime_s(&tm1, &tt);
|
if (localtime_s(&tm1, &tt) != 0 ) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
ss.wYear = tm1.tm_year + 1900;
|
ss.wYear = tm1.tm_year + 1900;
|
||||||
ss.wMonth = tm1.tm_mon + 1;
|
ss.wMonth = tm1.tm_mon + 1;
|
||||||
ss.wDay = tm1.tm_mday;
|
ss.wDay = tm1.tm_mday;
|
||||||
|
@ -445,10 +446,9 @@ struct tm *taosLocalTime(const time_t *timep, struct tm *result) {
|
||||||
result->tm_yday = 0;
|
result->tm_yday = 0;
|
||||||
result->tm_isdst = 0;
|
result->tm_isdst = 0;
|
||||||
} else {
|
} else {
|
||||||
if (*timep > _MAX__TIME64_T) {
|
if (localtime_s(result, timep) != 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
localtime_s(result, timep);
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
localtime_r(timep, result);
|
localtime_r(timep, result);
|
||||||
|
|
Loading…
Reference in New Issue