diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-04-23 07:53:17 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-04-23 07:53:17 +0900 |
| commit | dc88a87f9b062b744b0500ffd5ffddfbd9308c2b (patch) | |
| tree | 318f5a9aa7783d0f5ecebb3612815d1a63d8d27b | |
| parent | 1a82bab1b04a4e55cd802af2b54d84a1ac4c5a79 (diff) | |
| download | mruby-dc88a87f9b062b744b0500ffd5ffddfbd9308c2b.tar.gz mruby-dc88a87f9b062b744b0500ffd5ffddfbd9308c2b.zip | |
time.c: `time_t` may be unsigned on some platforms.
| -rw-r--r-- | mrbgems/mruby-time/src/time.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c index 22dec2e65..44bea5ffa 100644 --- a/mrbgems/mruby-time/src/time.c +++ b/mrbgems/mruby-time/src/time.c @@ -334,7 +334,7 @@ time_alloc_time(mrb_state *mrb, time_t sec, time_t usec, enum mrb_timezone timez tm = (struct mrb_time *)mrb_malloc(mrb, sizeof(struct mrb_time)); tm->sec = sec; tm->usec = usec; - if (tm->usec < 0) { + if (MRB_TIME_T_UINT && tm->usec < 0) { long sec2 = (long)NDIV(tm->usec,1000000); /* negative div */ tm->usec -= sec2 * 1000000; tm->sec += sec2; @@ -462,7 +462,7 @@ time_mktime(mrb_state *mrb, mrb_int ayear, mrb_int amonth, mrb_int aday, struct tm nowtime = { 0 }; #if MRB_INT_MAX > INT_MAX -#define OUTINT(x) (INT_MIN > (x) || (x) > INT_MAX) +#define OUTINT(x) (((MRB_TIME_T_UINT ? 0 : INT_MIN) > (x)) || (x) > INT_MAX) #else #define OUTINT(x) 0 #endif |
