Skip to content

Commit

Permalink
Showing 2 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion spec/truffle/tags/core/time/at_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:Time.at passed Numeric returns a subclass instance on a Time subclass
fails:Time.at passed Time returns a subclass instance
fails:Time.at passed Numeric roundtrips a Rational produced by #to_r
fails:Time.at passed Numeric passed BigDecimal doesn't round input value
14 changes: 7 additions & 7 deletions truffle/src/main/java/org/jruby/truffle/core/time/TimeNodes.java
Original file line number Diff line number Diff line change
@@ -279,7 +279,7 @@ private DateTime now(DateTimeZone timeZone) {

}

@Primitive(name = "time_s_specific", needsSelf = false, lowerFixnum = 2)
@Primitive(name = "time_s_specific", lowerFixnum = 2)
public static abstract class TimeSSpecificPrimitiveNode extends PrimitiveArrayArgumentsNode {

@Child private GetTimeZoneNode getTimeZoneNode;
@@ -290,23 +290,23 @@ public TimeSSpecificPrimitiveNode(RubyContext context, SourceSection sourceSecti
}

@Specialization(guards = { "isUTC" })
public DynamicObject timeSSpecificUTC(long seconds, int nanoseconds, boolean isUTC, Object offset) {
public DynamicObject timeSSpecificUTC(DynamicObject timeClass, long seconds, int nanoseconds, boolean isUTC, Object offset) {
final long milliseconds = getMillis(seconds, nanoseconds);
return Layouts.TIME.createTime(coreLibrary().getTimeFactory(), utcTime(milliseconds), nanoseconds % 1_000_000, nil(), nil(), false, isUTC);
return Layouts.TIME.createTime(Layouts.CLASS.getInstanceFactory(timeClass), utcTime(milliseconds), nanoseconds % 1_000_000, nil(), nil(), false, isUTC);
}

@Specialization(guards = { "!isUTC", "isNil(offset)" })
public DynamicObject timeSSpecific(VirtualFrame frame, long seconds, int nanoseconds, boolean isUTC, Object offset) {
public DynamicObject timeSSpecific(VirtualFrame frame, DynamicObject timeClass, long seconds, int nanoseconds, boolean isUTC, Object offset) {
final long milliseconds = getMillis(seconds, nanoseconds);
return Layouts.TIME.createTime(coreLibrary().getTimeFactory(),
return Layouts.TIME.createTime(Layouts.CLASS.getInstanceFactory(timeClass),
localtime(milliseconds, getTimeZoneNode.executeGetTimeZone(frame)),
nanoseconds % 1_000_000, nil(), offset, false, isUTC);
}

@Specialization(guards = { "!isUTC" })
public DynamicObject timeSSpecific(VirtualFrame frame, long seconds, int nanoseconds, boolean isUTC, long offset) {
public DynamicObject timeSSpecific(VirtualFrame frame, DynamicObject timeClass, long seconds, int nanoseconds, boolean isUTC, long offset) {
final long milliseconds = getMillis(seconds, nanoseconds);
return Layouts.TIME.createTime(coreLibrary().getTimeFactory(),
return Layouts.TIME.createTime(Layouts.CLASS.getInstanceFactory(timeClass),
offsetTime(milliseconds, offset), nanoseconds % 1_000_000, nil(), nil(), false, isUTC);
}

0 comments on commit 15d4875

Please sign in to comment.