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 --- README.md | 4 +++- lib/axlsx/workbook/worksheet/cell.rb | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9cb98a7c..8d7d1d7e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ Axlsx: Office Open XML Spreadsheet Generation ==================================== +[![Build Status](https://secure.travis-ci.org/randym/axlsx.png)](http://travis-ci.org/randym/axlsx/) **IRC**: [irc.freenode.net / #axlsx](irc://irc.freenode.net/axlsx) **Git**: [http://github.com/randym/axlsx](http://github.com/randym/axlsx) @@ -7,7 +8,8 @@ Axlsx: Office Open XML Spreadsheet Generation **Copyright**: 2011 **License**: MIT License **Latest Version**: 1.0.10 -**Ruby Version**: 1.8.7 - 1.9.3 +**Ruby Version**: 1.8.7, 1.9.3 + **Release Date**: November 29th 2011 Synopsis 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