Skip to content
Permalink
Browse files
[Truffle] Time#- should use real rather than integral seconds.
  • Loading branch information
chrisseaton committed Oct 12, 2014
1 parent 440ee53 commit a870e579d4252c644efd9b1f88db4af6b7d556be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
@@ -33,7 +33,7 @@ public SubNode(SubNode prev) {

@Specialization
public double sub(RubyTime a, RubyTime b) {
return a.getSeconds() - b.getSeconds();
return a.getRealSeconds() - b.getRealSeconds();
}

}
@@ -48,10 +48,14 @@ public RubyTime(RubyClass timeClass, long seconds, long nanoseconds) {
this.nanoseconds = nanoseconds;
}

public long getSeconds() {
public long getWholeSeconds() {
return seconds;
}

public double getRealSeconds() {
return seconds + nanosecondsToSecond(nanoseconds);
}

public static RubyTime fromDate(RubyClass timeClass, long timeMiliseconds) {
return new RubyTime(timeClass, milisecondsToSeconds(timeMiliseconds), milisecondsToNanoseconds(timeMiliseconds));
}

0 comments on commit a870e57

Please sign in to comment.