From 65b75c23c1911caeeb9206924cd6a009e241fb03 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Wed, 30 Nov 2011 08:10:13 +0900 Subject: 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 --- lib/axlsx/workbook/worksheet/cell.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3