Skip to content

Commit

Permalink
Remove deprecated Time::Span.new variants (#10051)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sija authored Dec 9, 2020
1 parent d62c7ae commit 69555fe
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
13 changes: 0 additions & 13 deletions spec/std/time/span_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,13 @@ describe Time::Span do

t1 = Time::Span.new hours: 25
t1.to_s.should eq("1.01:00:00")

t1 = Time::Span.new(1, 2, 3)
t1.to_s.should eq("01:02:03")
typeof(t1).should eq(Time::Span)

t1 = Time::Span.new(1, 2, 3, 4, 5)
t1.to_s.should eq("1.02:03:04.000000005")
typeof(t1).should eq(Time::Span)
end

it "initializes with big seconds value" do
t = Time::Span.new hours: 0, minutes: 0, seconds: 1231231231231
t.total_seconds.should eq(1231231231231)
end

it "initialize deprecated constructors" do
t = Time::Span.new(0, 0, 0, 0, nanoseconds: 1)
t.total_nanoseconds.should eq(1)
end

it "days overflows" do
expect_overflow do
days = 106751991167301
Expand Down
13 changes: 0 additions & 13 deletions src/time/span.cr
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,6 @@ struct Time::Span
# @nanoseconds can either be negative or positive).
@nanoseconds : Int32

@[Deprecated("Use `new` with named arguments instead.")]
def self.new(_hours : Int, _minutes : Int, _seconds : Int)
new(0, _hours, _minutes, _seconds)
end

@[Deprecated("Use `new` with named arguments instead.")]
def self.new(_days : Int, _hours : Int, _minutes : Int, _seconds : Int, nanoseconds : Int = 0)
new(
seconds: compute_seconds(_days, _hours, _minutes, _seconds),
nanoseconds: nanoseconds.to_i64,
)
end

# Creates a new `Time::Span` from *seconds* and *nanoseconds*.
#
# Nanoseconds get normalized in the range of `0...1_000_000_000`,
Expand Down

0 comments on commit 69555fe

Please sign in to comment.