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:
parent
a7d0c2c448
commit
6721ce1cc4
Notes:
git
2021-12-02 15:54:07 +09:00
1 changed files with 1 additions and 1 deletions
2
gc.c
2
gc.c
|
@ -12395,7 +12395,7 @@ current_process_time(struct timespec *ts)
|
||||||
if (getrusage(RUSAGE_SELF, &usage) == 0) {
|
if (getrusage(RUSAGE_SELF, &usage) == 0) {
|
||||||
time = usage.ru_utime;
|
time = usage.ru_utime;
|
||||||
ts->tv_sec = time.tv_sec;
|
ts->tv_sec = time.tv_sec;
|
||||||
ts->tv_nsec = time.tv_usec * 1000;
|
ts->tv_nsec = (int32_t)time.tv_usec * 1000;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue