1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Cast tv_usec to int32_t to fit in tv_nsec

suseconds_t, which is the type of tv_usec, may be defined with a longer
size type than tv_nsec's type (long). So usec to nsec conversion needs
an explicit casting.
This commit is contained in:
Yuta Saito 2021-12-02 13:20:13 +09:00 committed by Yusuke Endoh
parent a7d0c2c448
commit 6721ce1cc4
Notes: git 2021-12-02 15:54:07 +09:00

2
gc.c
View file

@ -12395,7 +12395,7 @@ current_process_time(struct timespec *ts)
if (getrusage(RUSAGE_SELF, &usage) == 0) {
time = usage.ru_utime;
ts->tv_sec = time.tv_sec;
ts->tv_nsec = time.tv_usec * 1000;
ts->tv_nsec = (int32_t)time.tv_usec * 1000;
return true;
}
}