Navigation Menu

Skip to content

Commit

Permalink
[Truffle] Time#- should use real rather than integral seconds.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Oct 12, 2014
1 parent 440ee53 commit a870e57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Expand Up @@ -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();
}

}
Expand Down
Expand Up @@ -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));
}
Expand Down

0 comments on commit a870e57

Please sign in to comment.