File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/main/ruby/truffleruby/core Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -169,9 +169,13 @@ def self.clock_gettime(id, unit=:float_second)
169
169
end
170
170
171
171
def self . nanoseconds_to_unit ( nanoseconds , unit )
172
- case unit
172
+ case unit # ordered by expected frequency
173
173
when :float_second , nil
174
174
nanoseconds / 1e9
175
+ when :nanosecond
176
+ nanoseconds
177
+ when :microsecond
178
+ nanoseconds / 1_000
175
179
when :float_microsecond
176
180
nanoseconds / 1e3
177
181
when :float_millisecond
@@ -180,10 +184,6 @@ def self.nanoseconds_to_unit(nanoseconds, unit)
180
184
nanoseconds / 1_000_000_000
181
185
when :millisecond
182
186
nanoseconds / 1_000_000
183
- when :microsecond
184
- nanoseconds / 1_000
185
- when :nanosecond
186
- nanoseconds
187
187
else
188
188
raise ArgumentError , "unexpected unit: #{ unit } "
189
189
end
You can’t perform that action at this time.
0 commit comments