Skip to content

Commit b064d7e

Browse files
committed
mruby-time/time.c (time_alloc_time): need to handle negative time_t
1 parent ec3baec commit b064d7e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mrbgems/mruby-time/src/time.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ time_alloc_time(mrb_state *mrb, time_t sec, time_t usec, enum mrb_timezone timez
363363
tm = (struct mrb_time*)mrb_malloc(mrb, sizeof(struct mrb_time));
364364
tm->sec = sec;
365365
tm->usec = usec;
366-
if (MRB_TIME_T_UINT && tm->usec < 0) {
366+
if (!MRB_TIME_T_UINT && tm->usec < 0) {
367367
long sec2 = (long)NDIV(tm->usec,1000000); /* negative div */
368368
tm->usec -= sec2 * 1000000;
369369
tm->sec += sec2;

0 commit comments

Comments
 (0)