Sha256: c4664229c442ed89558b3f1ff0f66db85b765a15ed672203f3bc6f3fd497ca43

Contents?: true

Size: 1016 Bytes

Versions: 83

Compression:

Stored size: 1016 Bytes

Contents

require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper'
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/fixtures/methods'

describe "Time#_load" do
  ruby_bug("http://redmine.ruby-lang.org/issues/show/627", "1.8.7") do
    it "loads a time object in the new format" do
      t = Time.local(2000, 1, 15, 20, 1, 1)
      t = t.gmtime

      high =               1 << 31 |
            (t.gmt? ? 1 : 0) << 30 |
             (t.year - 1900) << 14 |
                (t.mon  - 1) << 10 |
                       t.mday << 5 |
                            t.hour

      low =  t.min  << 26 |
             t.sec  << 20 |
                   t.usec

      Time._load([high, low].pack("VV")).should == t
    end
  end

  it "loads a time object in the old UNIX timestamp based format" do
    t = Time.local(2000, 1, 15, 20, 1, 1, 203)
    timestamp = t.to_i

    high = timestamp & ((1 << 31) - 1)

    low =  t.usec

    Time._load([high, low].pack("VV")).should == t
  end
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
rhodes-3.1.1 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.1.1.beta spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.1.0 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.1.0.beta.5 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.1.0.beta.4 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.1.0.beta.3 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.1.0.beta.2 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.1.0.beta.1 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.0.2 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.0.2.beta.1 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.0.1 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.0.1.beta.8 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.0.1.beta.7 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.0.1.beta.6 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.0.1.beta.5 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.0.1.beta.4 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.0.1.beta.3 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.0.1.beta.2 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.0.0 spec/framework_spec/app/spec/core/time/_load_spec.rb
rhodes-3.0.0.beta.7 spec/framework_spec/app/spec/core/time/_load_spec.rb