@@ -74,7 +74,6 @@ protected RubyTime allocate(RubyClass rubyClass) {
74
74
75
75
@ CoreMethod (names = "initialize_copy" , required = 1 )
76
76
public abstract static class InitializeCopyNode extends CoreMethodArrayArgumentsNode {
77
-
78
77
@ Specialization
79
78
protected RubyTime initializeCopy (RubyTime self , RubyTime from ) {
80
79
self .dateTime = from .dateTime ;
@@ -84,7 +83,6 @@ protected RubyTime initializeCopy(RubyTime self, RubyTime from) {
84
83
self .isUtc = from .isUtc ;
85
84
return self ;
86
85
}
87
-
88
86
}
89
87
90
88
@ Primitive (name = "time_localtime" )
@@ -140,7 +138,6 @@ private ZonedDateTime withZone(ZonedDateTime dateTime, ZoneId zone) {
140
138
141
139
@ Primitive (name = "time_add" )
142
140
public abstract static class TimeAddNode extends PrimitiveArrayArgumentsNode {
143
-
144
141
@ TruffleBoundary
145
142
@ Specialization
146
143
protected RubyTime add (RubyTime time , long seconds , long nanoSeconds ) {
@@ -229,54 +226,42 @@ private ZonedDateTime getDateTime(long seconds, int nanoseconds, ZoneId timeZone
229
226
230
227
@ CoreMethod (names = { "to_i" , "tv_sec" })
231
228
public abstract static class TimeSecondsSinceEpochNode extends CoreMethodArrayArgumentsNode {
232
-
233
229
@ TruffleBoundary
234
230
@ Specialization
235
231
protected long timeSeconds (RubyTime time ) {
236
232
return time .dateTime .toInstant ().getEpochSecond ();
237
233
}
238
-
239
234
}
240
235
241
236
@ CoreMethod (names = { "usec" , "tv_usec" })
242
237
public abstract static class TimeMicroSecondsNode extends CoreMethodArrayArgumentsNode {
243
-
244
- @ TruffleBoundary
245
238
@ Specialization
246
239
protected int timeUSec (RubyTime time ) {
247
240
return time .dateTime .getNano () / 1000 ;
248
241
}
249
-
250
242
}
251
243
252
244
@ CoreMethod (names = { "nsec" , "tv_nsec" })
253
245
public abstract static class TimeNanoSecondsNode extends CoreMethodArrayArgumentsNode {
254
-
255
- @ TruffleBoundary
256
246
@ Specialization
257
247
protected int timeNSec (RubyTime time ) {
258
248
return time .dateTime .getNano ();
259
249
}
260
-
261
250
}
262
251
263
252
@ Primitive (name = "time_set_nseconds" , lowerFixnum = 1 )
264
253
public abstract static class TimeSetNSecondsPrimitiveNode extends PrimitiveArrayArgumentsNode {
265
-
266
254
@ TruffleBoundary
267
255
@ Specialization
268
256
protected long timeSetNSeconds (RubyTime time , int nanoseconds ) {
269
257
final ZonedDateTime dateTime = time .dateTime ;
270
258
time .dateTime = dateTime .plusNanos (nanoseconds - dateTime .getNano ());
271
259
return nanoseconds ;
272
260
}
273
-
274
261
}
275
262
276
263
@ CoreMethod (names = { "utc_offset" , "gmt_offset" , "gmtoff" })
277
264
public abstract static class TimeUTCOffsetNode extends CoreMethodArrayArgumentsNode {
278
-
279
- @ TruffleBoundary
280
265
@ Specialization
281
266
protected int timeUTCOffset (RubyTime time ) {
282
267
return time .dateTime .getOffset ().getTotalSeconds ();
@@ -285,73 +270,54 @@ protected int timeUTCOffset(RubyTime time) {
285
270
286
271
@ CoreMethod (names = "sec" )
287
272
public abstract static class TimeSecNode extends CoreMethodArrayArgumentsNode {
288
-
289
- @ TruffleBoundary
290
273
@ Specialization
291
274
protected int timeSec (RubyTime time ) {
292
275
return time .dateTime .getSecond ();
293
276
}
294
-
295
277
}
296
278
297
279
@ CoreMethod (names = "min" )
298
280
public abstract static class TimeMinNode extends CoreMethodArrayArgumentsNode {
299
-
300
- @ TruffleBoundary
301
281
@ Specialization
302
282
protected int timeMin (RubyTime time ) {
303
283
return time .dateTime .getMinute ();
304
284
}
305
-
306
285
}
307
286
308
287
@ CoreMethod (names = "hour" )
309
288
public abstract static class TimeHourNode extends CoreMethodArrayArgumentsNode {
310
-
311
- @ TruffleBoundary
312
289
@ Specialization
313
290
protected int timeHour (RubyTime time ) {
314
291
return time .dateTime .getHour ();
315
292
}
316
-
317
293
}
318
294
319
295
@ CoreMethod (names = { "day" , "mday" })
320
296
public abstract static class TimeDayNode extends CoreMethodArrayArgumentsNode {
321
-
322
- @ TruffleBoundary
323
297
@ Specialization
324
298
protected int timeDay (RubyTime time ) {
325
299
return time .dateTime .getDayOfMonth ();
326
300
}
327
-
328
301
}
329
302
330
303
@ CoreMethod (names = { "mon" , "month" })
331
304
public abstract static class TimeMonthNode extends CoreMethodArrayArgumentsNode {
332
-
333
- @ TruffleBoundary
334
305
@ Specialization
335
306
protected int timeMonth (RubyTime time ) {
336
307
return time .dateTime .getMonthValue ();
337
308
}
338
-
339
309
}
340
310
341
311
@ CoreMethod (names = "year" )
342
312
public abstract static class TimeYearNode extends CoreMethodArrayArgumentsNode {
343
-
344
- @ TruffleBoundary
345
313
@ Specialization
346
314
protected int timeYear (RubyTime time ) {
347
315
return time .dateTime .getYear ();
348
316
}
349
-
350
317
}
351
318
352
319
@ CoreMethod (names = "wday" )
353
320
public abstract static class TimeWeekDayNode extends CoreMethodArrayArgumentsNode {
354
-
355
321
@ TruffleBoundary
356
322
@ Specialization
357
323
protected int timeWeekDay (RubyTime time ) {
@@ -361,50 +327,41 @@ protected int timeWeekDay(RubyTime time) {
361
327
}
362
328
return wday ;
363
329
}
364
-
365
330
}
366
331
367
332
@ CoreMethod (names = "yday" )
368
333
public abstract static class TimeYearDayNode extends CoreMethodArrayArgumentsNode {
369
-
370
334
@ TruffleBoundary
371
335
@ Specialization
372
336
protected int timeYeayDay (RubyTime time ) {
373
337
return time .dateTime .getDayOfYear ();
374
338
}
375
-
376
339
}
377
340
378
341
@ CoreMethod (names = { "dst?" , "isdst" })
379
342
public abstract static class TimeIsDSTNode extends CoreMethodArrayArgumentsNode {
380
-
381
343
@ TruffleBoundary
382
344
@ Specialization
383
345
protected boolean timeIsDST (RubyTime time ) {
384
346
final ZonedDateTime dateTime = time .dateTime ;
385
347
return dateTime .getZone ().getRules ().isDaylightSavings (dateTime .toInstant ());
386
348
}
387
-
388
349
}
389
350
390
351
@ CoreMethod (names = { "utc?" , "gmt?" })
391
352
public abstract static class IsUTCNode extends CoreMethodArrayArgumentsNode {
392
-
393
353
@ Specialization
394
354
protected boolean isUTC (RubyTime time ) {
395
355
return time .isUtc ;
396
356
}
397
-
398
357
}
399
358
400
359
@ Primitive (name = "time_zone" )
401
360
public abstract static class TimeZoneNode extends PrimitiveArrayArgumentsNode {
402
-
403
361
@ Specialization
404
362
protected Object timeZone (RubyTime time ) {
405
363
return time .zone ;
406
364
}
407
-
408
365
}
409
366
410
367
@ Primitive (name = "time_strftime" )
0 commit comments