@@ -1419,15 +1419,13 @@ public static IRubyObject times(Ruby runtime) {
1419
1419
Block .NULL_BLOCK );
1420
1420
}
1421
1421
1422
- // this is only in 2.1. See https://bugs.ruby-lang.org/issues/8658
1423
1422
@ JRubyMethod (module = true , visibility = PRIVATE )
1424
1423
public static IRubyObject clock_gettime (ThreadContext context , IRubyObject self , IRubyObject _clock_id ) {
1425
1424
Ruby runtime = context .runtime ;
1426
1425
1427
1426
return makeClockResult (runtime , getTimeForClock (_clock_id , runtime ), CLOCK_UNIT_FLOAT_SECOND );
1428
1427
}
1429
1428
1430
- // this is only in 2.1. See https://bugs.ruby-lang.org/issues/8658
1431
1429
@ JRubyMethod (module = true , visibility = PRIVATE )
1432
1430
public static IRubyObject clock_gettime (ThreadContext context , IRubyObject self , IRubyObject _clock_id , IRubyObject _unit ) {
1433
1431
Ruby runtime = context .runtime ;
@@ -1451,9 +1449,10 @@ private static long getTimeForClock(IRubyObject _clock_id, Ruby runtime) throws
1451
1449
long nanos ;
1452
1450
1453
1451
if (_clock_id instanceof RubySymbol ) {
1454
- if (_clock_id .toString ().equals (CLOCK_MONOTONIC )) {
1452
+ RubySymbol clock_id = (RubySymbol ) _clock_id ;
1453
+ if (clock_id .idString ().equals (CLOCK_MONOTONIC )) {
1455
1454
nanos = System .nanoTime ();
1456
- } else if (_clock_id . toString ().equals (CLOCK_REALTIME )) {
1455
+ } else if (clock_id . idString ().equals (CLOCK_REALTIME )) {
1457
1456
POSIX posix = runtime .getPosix ();
1458
1457
if (posix .isNative ()) {
1459
1458
Timeval tv = posix .allocateTimeval ();
@@ -1479,9 +1478,10 @@ private static long getResolutionForClock(IRubyObject _clock_id, Ruby runtime) t
1479
1478
long nanos ;
1480
1479
1481
1480
if (_clock_id instanceof RubySymbol ) {
1482
- if (_clock_id .toString ().equals (CLOCK_MONOTONIC )) {
1481
+ RubySymbol clock_id = (RubySymbol ) _clock_id ;
1482
+ if (clock_id .idString ().equals (CLOCK_MONOTONIC )) {
1483
1483
nanos = 1 ;
1484
- } else if (_clock_id . toString ().equals (CLOCK_REALTIME )) {
1484
+ } else if (clock_id . idString ().equals (CLOCK_REALTIME )) {
1485
1485
nanos = 1000000 ;
1486
1486
} else {
1487
1487
throw runtime .newErrnoEINVALError ("clock_gettime" );
0 commit comments