From 3cd46c72882d3bb42bc46b67dbc12cbd805d0c4f Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Tue, 29 Nov 2011 20:07:44 +0900 Subject: trying to fix 'out of range' for time creation on travis --- 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 0d15721b..3babefa2 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 - epoc = Workbook.date1904 ? Time.local(1904,1,1,0,0,0,0,v.zone) : Time.local(1900,1,1,0,0,0,0,v.zone) - ((v - epoc) /60.0/60.0/24.0).to_f + epoc = Workbook.date1904 ? Time.local(1904,1,1,0,0,0,0) : Time.local(1900,1,1,0,0,0,0) + ((v.localtime - epoc) /60.0/60.0/24.0).to_f elsif @type == :float v.to_f elsif @type == :integer -- cgit v1.2.3