diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-01-27 11:41:31 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-01-27 11:41:31 +0900 |
| commit | 1b597f9da45aecfc4d02752629d93de1325d86a4 (patch) | |
| tree | 161492459a1df823270aaf6dcb438382ab78efa5 | |
| parent | 8a988643e84d290777a00907e3db1f8ca8940b05 (diff) | |
| parent | 995a329bf4983beb1322c2e2c4399c11bdb852fa (diff) | |
| download | mruby-1b597f9da45aecfc4d02752629d93de1325d86a4.tar.gz mruby-1b597f9da45aecfc4d02752629d93de1325d86a4.zip | |
Merge pull request #4249 from takkaw/fix_time_carry_up_and_down
fix Time about carry-up and carry-down
| -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 c3a0ac435..d70fb442c 100644 --- a/mrbgems/mruby-time/src/time.c +++ b/mrbgems/mruby-time/src/time.c @@ -263,12 +263,12 @@ time_alloc(mrb_state *mrb, double sec, double usec, enum mrb_timezone timezone) tm->sec = tsec; tm->usec = (time_t)llround((sec - tm->sec) * 1.0e6 + usec); if (tm->usec < 0) { - long sec2 = (long)NDIV(usec,1000000); /* negative div */ + long sec2 = (long)NDIV(tm->usec,1000000); /* negative div */ tm->usec -= sec2 * 1000000; tm->sec += sec2; } else if (tm->usec >= 1000000) { - long sec2 = (long)(usec / 1000000); + long sec2 = (long)(tm->usec / 1000000); tm->usec -= sec2 * 1000000; tm->sec += sec2; } |
