ruby-changes:70011
From: Yuta <ko1@a...>
Date: Thu, 2 Dec 2021 15:54:02 +0900 (JST)
Subject: [ruby-changes:70011] 6721ce1cc4 (master): Cast tv_usec to int32_t to fit in tv_nsec
https://git.ruby-lang.org/ruby.git/commit/?id=6721ce1cc4 From 6721ce1cc4035fe5508c13d0151f748e8b8e8cf1 Mon Sep 17 00:00:00 2001 From: Yuta Saito <kateinoigakukun@g...> Date: Thu, 2 Dec 2021 13:20:13 +0900 Subject: 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. --- gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gc.c b/gc.c index ed7b3dfda3b..8aecf70ab3f 100644 --- a/gc.c +++ b/gc.c @@ -12395,7 +12395,7 @@ current_process_time(struct timespec *ts) https://github.com/ruby/ruby/blob/trunk/gc.c#L12395 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; } } -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/