Skip to content

Commit

Permalink
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec/std/time/span_spec.cr
Original file line number Diff line number Diff line change
@@ -228,4 +228,8 @@ describe Time::Span do
t1.to_f.should be_close(93784, 1e-01)
t1.to_i.should eq(93784)
end

it "should sum" do
[1.second, 5.seconds].sum.should eq(6.seconds)
end
end
4 changes: 4 additions & 0 deletions src/time/span.cr
Original file line number Diff line number Diff line change
@@ -278,6 +278,10 @@ struct Time::Span
val = (value < 0 ? (value - 0.5) : (value + 0.5)).to_i64 # round away from zero
Span.new(val * TicksPerMillisecond)
end

def self.zero
new(0)
end
end

struct Int

0 comments on commit 8086061

Please sign in to comment.