From e99f1ecbe8311f1dbe2b889a82a528f3e85e366d Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Wed, 30 Nov 2011 08:32:32 +0900 Subject: Hardcoding time offset from 1970 as using time for dates this far in the past will break on some systems. Adding in travis build status --- lib/axlsx/workbook/worksheet/cell.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index 49b2eeb5..1b1b60cc 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -169,7 +169,9 @@ 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 = -2209021200 #Time.local(1900, 1, 1) + # Using hardcoded offsets here as some operating systems will not except a 'negative' offset from the ruby epoc. + # (1970) + epoc1900 = -2209021200 #Time.local(1900, 1, 1) epoc1904 = -2082877200 #Time.local(1904, 1, 1) epoc = Workbook.date1904 ? epoc1904 : epoc1900 ((v.localtime.to_f - epoc) /60.0/60.0/24.0).to_f -- cgit v1.2.3