summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJurriaan Pruis <[email protected]>2012-03-02 10:23:03 +0100
committerSean Duckett <[email protected]>2012-03-07 14:45:03 -0600
commit5b1860121aa20b83033792192617fbe6cf9b455b (patch)
tree85b1f407e8fe93ed5aaa14681fb4f2a012606872
parent516553a4888ab21e1dee3d7f68a6c481134572ed (diff)
downloadcaxlsx-5b1860121aa20b83033792192617fbe6cf9b455b.tar.gz
caxlsx-5b1860121aa20b83033792192617fbe6cf9b455b.zip
epoc => epoch
-rw-r--r--README.md2
-rw-r--r--lib/axlsx/workbook/worksheet/date_time_converter.rb14
-rw-r--r--test/workbook/worksheet/tc_date_time_converter.rb2
3 files changed, 9 insertions, 9 deletions
diff --git a/README.md b/README.md
index 37a09854..f23bcde7 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,7 @@ Feature List
**5. Automatic and fixed column widths: Axlsx will automatically determine the appropriate width for your columns based on the content in the worksheet, or use any value you specify for the really funky stuff.
-**6. Support for automatically formatted 1904 and 1900 epocs configurable in the workbook.
+**6. Support for automatically formatted 1904 and 1900 epochs configurable in the workbook.
**7. Add jpg, gif and png images to worksheets with hyperlinks
diff --git a/lib/axlsx/workbook/worksheet/date_time_converter.rb b/lib/axlsx/workbook/worksheet/date_time_converter.rb
index 5a572781..d2d9a014 100644
--- a/lib/axlsx/workbook/worksheet/date_time_converter.rb
+++ b/lib/axlsx/workbook/worksheet/date_time_converter.rb
@@ -9,8 +9,8 @@ module Axlsx
# @param [Date] date the date to be serialized
# @return [Numeric]
def self.date_to_serial(date)
- epoc = Axlsx::Workbook::date1904 ? Date.new(1904) : Date.new(1899, 12, 30)
- (date-epoc).to_f
+ epoch = Axlsx::Workbook::date1904 ? Date.new(1904) : Date.new(1899, 12, 30)
+ (date-epoch).to_f
end
# The time_to_serial methond converts a Time object its excel serialized form.
@@ -18,12 +18,12 @@ module Axlsx
# @return [Numeric]
def self.time_to_serial(time)
# Using hardcoded offsets here as some operating systems will not except
- # a 'negative' offset from the ruby epoc.
- epoc1900 = -2209161600 # Time.utc(1899, 12, 30).to_i
- epoc1904 = -2082844800 # Time.utc(1904, 1, 1).to_i
+ # a 'negative' offset from the ruby epoch.
+ epoch1900 = -2209161600 # Time.utc(1899, 12, 30).to_i
+ epoch1904 = -2082844800 # Time.utc(1904, 1, 1).to_i
seconds_per_day = 86400 # 60*60*24
- epoc = Axlsx::Workbook::date1904 ? epoc1904 : epoc1900
- (time.to_f - epoc)/seconds_per_day
+ epoch = Axlsx::Workbook::date1904 ? epoch1904 : epoch1900
+ (time.to_f - epoch)/seconds_per_day
end
end
end
diff --git a/test/workbook/worksheet/tc_date_time_converter.rb b/test/workbook/worksheet/tc_date_time_converter.rb
index 529da917..c78e51eb 100644
--- a/test/workbook/worksheet/tc_date_time_converter.rb
+++ b/test/workbook/worksheet/tc_date_time_converter.rb
@@ -88,7 +88,7 @@ class TestDateTimeConverter < Test::Unit::TestCase
def test_time_to_serial_1904
Axlsx::Workbook.date1904 = true
- # ruby 1.8.7 cannot parse dates prior to epoc. see http://ruby-doc.org/core-1.8.7/Time.html
+ # ruby 1.8.7 cannot parse dates prior to epoch. see http://ruby-doc.org/core-1.8.7/Time.html
tests = if @extended_time_range
{ # examples taken straight from the spec