File tree Expand file tree Collapse file tree 1 file changed +24
-24
lines changed Expand file tree Collapse file tree 1 file changed +24
-24
lines changed Original file line number Diff line number Diff line change @@ -117,30 +117,30 @@ def self.time
117
117
118
118
def self . clock_getres ( id , unit = :float_second )
119
119
res = case id
120
- when :MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC ,
121
- CLOCK_MONOTONIC
122
- 1
123
- when :GETTIMEOFDAY_BASED_CLOCK_REALTIME ,
124
- :GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID ,
125
- :CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID
126
- 1_000
127
- when CLOCK_REALTIME
128
- 1_000_000
129
- when :TIMES_BASED_CLOCK_MONOTONIC ,
130
- :TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID
131
- 10_000_000
132
- when :TIME_BASED_CLOCK_REALTIME
133
- 1_000_000_000
134
- when Symbol
135
- raise Errno ::EINVAL
136
- else
137
- _res = Truffle ::POSIX . truffleposix_clock_getres ( id )
138
- if _res == 0 then
139
- Errno . handle
140
- else
141
- _res
142
- end
143
- end
120
+ when :MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC ,
121
+ CLOCK_MONOTONIC
122
+ 1
123
+ when :GETTIMEOFDAY_BASED_CLOCK_REALTIME ,
124
+ :GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID ,
125
+ :CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID
126
+ 1_000
127
+ when CLOCK_REALTIME
128
+ 1_000_000
129
+ when :TIMES_BASED_CLOCK_MONOTONIC ,
130
+ :TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID
131
+ 10_000_000
132
+ when :TIME_BASED_CLOCK_REALTIME
133
+ 1_000_000_000
134
+ when Symbol
135
+ raise Errno ::EINVAL
136
+ else
137
+ res_for_id = Truffle ::POSIX . truffleposix_clock_getres ( id )
138
+ if res_for_id == 0 then
139
+ Errno . handle
140
+ else
141
+ res_for_id
142
+ end
143
+ end
144
144
145
145
if :hertz == unit then
146
146
1.0 / nanoseconds_to_unit ( res , :float_second )
You can’t perform that action at this time.
0 commit comments