HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/src/ruby-3.0.2/spec/ruby/core/time/shared/to_i.rb
describe :time_to_i, shared: true do
  it "returns the value of time as an integer number of seconds since epoch" do
    Time.at(0).send(@method).should == 0
  end

  it "doesn't return an actual number of seconds in time" do
    Time.at(65.5).send(@method).should == 65
  end

  it "rounds fractional seconds toward zero" do
    t = Time.utc(1960, 1, 1, 0, 0, 0, 999_999)

    t.to_f.to_i.should == -315619199
    t.to_i.should == -315619200
  end
end