summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorYuta Saito <kateinoigakukun@gmail.com>2021-12-02 13:20:13 +0900
committerYusuke Endoh <mame@ruby-lang.org>2021-12-02 15:53:43 +0900
commit6721ce1cc4035fe5508c13d0151f748e8b8e8cf1 (patch)
treeda53c746c87abfadd66811adf279743300f13397 /gc.c
parenta7d0c2c4489f94a0087646040afccb66cec4e7d7 (diff)
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.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5200
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index ed7b3dfda3..8aecf70ab3 100644
--- a/gc.c
+++ b/gc.c
@@ -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;
}
}