diff options
| author | Randy Morgan <[email protected]> | 2011-11-30 08:10:13 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2011-11-30 08:10:13 +0900 |
| commit | 65b75c23c1911caeeb9206924cd6a009e241fb03 (patch) | |
| tree | dd33730d33ab8fc76b6ddb3c3047b837bf0426ae | |
| parent | 1313e3b246cbddba3d0e6b1cdcc63be4e675b903 (diff) | |
| download | caxlsx-65b75c23c1911caeeb9206924cd6a009e241fb03.tar.gz caxlsx-65b75c23c1911caeeb9206924cd6a009e241fb03.zip | |
From the docs on time "On some operating systems, this offset is allowed to be negative." perhaps travis is one of those systems that does not allow negative offsets. Using the integer value for 1900 and 1904 epocs
| -rw-r--r-- | Rakefile | 5 | ||||
| -rw-r--r-- | lib/axlsx/workbook/worksheet/cell.rb | 4 |
2 files changed, 2 insertions, 7 deletions
@@ -10,11 +10,6 @@ end task :test do require 'rake/testtask' - puts "The current time is: #{Time.now}" - - puts "1900 was: #{Time.local(1900,1,1)}" - puts "1904 was: #{Time.local(1904,1,1)}" - Rake::TestTask.new do |t| t.libs << 'test' t.test_files = FileList['test/**/tc_*.rb'] diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index a32d19e7..a279316b 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -169,8 +169,8 @@ module Axlsx def cast_value(v) if (@type == :time && v.is_a?(Time)) || (@type == :time && v.respond_to?(:to_time)) v = v.respond_to?(:to_time) ? v.to_time : v - epoc1900 = Time.local(1900, 1, 1) - epoc1904 = Time.local(1904, 1, 1) + epoc1900 = -2209021200 #Time.local(1900, 1, 1) + epoc1904 = -2082877200 #Time.local(1904, 1, 1) epoc = Workbook.date1904 ? epoc1904 : epoc1900 ((v.localtime - epoc) /60.0/60.0/24.0).to_f elsif @type == :float |
