mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-10-18 01:02:50 +08:00
[simulator] 消除vs下的警告
This commit is contained in:
@@ -42,20 +42,14 @@ struct timezone
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure returned by gettimeofday(2) system call,
|
||||
* and used in other calls.
|
||||
*/
|
||||
#ifndef _TIMEVAL_DEFINED
|
||||
#if !defined(_TIMEVAL_DEFINED) && !defined(_WIN32)
|
||||
#define _TIMEVAL_DEFINED
|
||||
#if !defined(_WIN32)
|
||||
struct timeval
|
||||
{
|
||||
time_t tv_sec; /* seconds */
|
||||
suseconds_t tv_usec; /* and microseconds */
|
||||
};
|
||||
#endif
|
||||
#endif /* _TIMEVAL_DEFINED */
|
||||
|
||||
#if !(defined(__GNUC__) && !defined(__ARMCC_VERSION)/*GCC*/) && \
|
||||
!(defined(__ICCARM__) && (__VER__ >= 8010001)) && \
|
||||
@@ -73,6 +67,16 @@ int gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||
int settimeofday(const struct timeval *tv, const struct timezone *tz);
|
||||
#if defined(__ARMCC_VERSION) || defined (__ICCARM__)
|
||||
struct tm *gmtime_r(const time_t *timep, struct tm *r);
|
||||
#elif defined(_WIN32)
|
||||
struct tm* gmtime_r(const time_t* timep, struct tm* r);
|
||||
struct tm* gmtime(const time_t* t);
|
||||
struct tm* localtime_r(const time_t* t, struct tm* r);
|
||||
struct tm* localtime(const time_t* t);
|
||||
time_t mktime(struct tm* const t);
|
||||
char* asctime_r(const struct tm* t, char* buf);
|
||||
char* ctime_r(const time_t* tim_p, char* result);
|
||||
char* ctime(const time_t* tim_p);
|
||||
time_t time(time_t* t);
|
||||
#endif
|
||||
|
||||
#ifdef RT_USING_POSIX_CLOCK
|
||||
|
@@ -217,7 +217,7 @@ struct tm* localtime_r(const time_t* t, struct tm* r)
|
||||
{
|
||||
time_t local_tz;
|
||||
|
||||
local_tz = *t + tz_get() * 3600;
|
||||
local_tz = *t + (time_t)tz_get() * 3600;
|
||||
return gmtime_r(&local_tz, r);
|
||||
}
|
||||
RTM_EXPORT(localtime_r);
|
||||
@@ -234,7 +234,7 @@ time_t mktime(struct tm * const t)
|
||||
time_t timestamp;
|
||||
|
||||
timestamp = timegm(t);
|
||||
timestamp = timestamp - 3600 * tz_get();
|
||||
timestamp = timestamp - 3600 * (time_t)tz_get();
|
||||
return timestamp;
|
||||
}
|
||||
RTM_EXPORT(mktime);
|
||||
@@ -367,7 +367,7 @@ time_t timegm(struct tm * const t)
|
||||
{
|
||||
register time_t day;
|
||||
register time_t i;
|
||||
register time_t years = t->tm_year - 70;
|
||||
register time_t years = (time_t)t->tm_year - 70;
|
||||
|
||||
if (t->tm_sec > 60)
|
||||
{
|
||||
|
Reference in New Issue
Block a user