diff options
| author | Meco Man <[email protected]> | 2021-05-01 06:08:14 +0800 |
|---|---|---|
| committer | Meco Man <[email protected]> | 2021-05-01 06:08:14 +0800 |
| commit | a611a6686402bd074cbaf53c53356c381ab54a5f (patch) | |
| tree | 13c494a2d4dfc3d9efe8ca4b08102927b8884e3e /components/libc/compilers | |
| parent | 65984a7116e747e022083774852f3a90617ca4e1 (diff) | |
精简代码
Diffstat (limited to 'components/libc/compilers')
| -rw-r--r-- | components/libc/compilers/common/time.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c index f7f52be9b4..799f71a2d0 100644 --- a/components/libc/compilers/common/time.c +++ b/components/libc/compilers/common/time.c @@ -212,14 +212,11 @@ struct tm* gmtime(const time_t* t) } RTM_EXPORT(gmtime); -/*TODO: timezone */ struct tm* localtime_r(const time_t* t, struct tm* r) { time_t local_tz; - int utc_plus; - utc_plus = RT_LIBC_FIXED_TIMEZONE; - local_tz = *t + utc_plus * 3600; + local_tz = *t + RT_LIBC_FIXED_TIMEZONE * 3600; return gmtime_r(&local_tz, r); } RTM_EXPORT(localtime_r); @@ -231,15 +228,12 @@ struct tm* localtime(const time_t* t) } RTM_EXPORT(localtime); -/* TODO: timezone */ time_t mktime(struct tm * const t) { time_t timestamp; - int utc_plus; - utc_plus = RT_LIBC_FIXED_TIMEZONE; timestamp = timegm(t); - timestamp = timestamp - 3600 * utc_plus; + timestamp = timestamp - 3600 * RT_LIBC_FIXED_TIMEZONE; return timestamp; } RTM_EXPORT(mktime); |
