From 7a4feec795ac8622edd099ed8b82b6230dc031be Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 31 Aug 2013 05:07:56 +0000 Subject: * lib/securerandom.rb (random_bytes): Use Process.clock_gettime. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/securerandom.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/securerandom.rb') diff --git a/lib/securerandom.rb b/lib/securerandom.rb index cc33a08044..b1603b4ca9 100644 --- a/lib/securerandom.rb +++ b/lib/securerandom.rb @@ -54,8 +54,8 @@ module SecureRandom @pid = 0 unless defined?(@pid) pid = $$ unless @pid == pid - now = Time.now - ary = [now.to_i, now.nsec, @pid, pid] + now = Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond) + ary = [now, @pid, pid] OpenSSL::Random.random_add(ary.join("").to_s, 0.0) @pid = pid end -- cgit v1.2.3