diff options
| author | Randy Morgan <[email protected]> | 2011-11-30 08:32:32 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2011-11-30 08:32:32 +0900 |
| commit | e99f1ecbe8311f1dbe2b889a82a528f3e85e366d (patch) | |
| tree | b70796e9b3fdda7a7f2352b18f0e69e8ddf2d84b /lib | |
| parent | c98f7b9953cc9d949a9d674aa0f649140af1a20e (diff) | |
| download | caxlsx-e99f1ecbe8311f1dbe2b889a82a528f3e85e366d.tar.gz caxlsx-e99f1ecbe8311f1dbe2b889a82a528f3e85e366d.zip | |
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
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/cell.rb | 4 |
1 files changed, 3 insertions, 1 deletions
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 |
