Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated Time::Span.new variants #10051

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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