opal/corelib/process.rb in opal-0.11.4 vs opal/corelib/process.rb in opal-1.0.0.beta1
- old
+ new
@@ -37,10 +37,10 @@
t = Time.now.to_f
Benchmark::Tms.new(t, t, t, t, t)
end
def self.clock_gettime(clock_id, unit = :float_second)
- clock = @__clocks__[clock_id] or raise Errno::EINVAL, "clock_gettime(#{clock_id}) #{@__clocks__[clock_id]}"
+ (clock = @__clocks__[clock_id]) || raise(Errno::EINVAL, "clock_gettime(#{clock_id}) #{@__clocks__[clock_id]}")
%x{
var ms = clock();
switch (unit) {
case 'float_second': return (ms / 1000); // number of seconds as a float (default)
case 'float_millisecond': return (ms / 1); // number of milliseconds as a float