Project

General

Profile

Actions

Bug #15160

closed

ArgumentError: year too big to marshal

Added by Dirk (Dirk Meier-Eickhoff) over 5 years ago. Updated almost 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:89164]

Description

I encountered the problem, that marshaling a Time object does not always work.

Try run following commands in irb that will raise an error:

Marshal.dump(Time.new(1900))
#Traceback (most recent call last):
#        3: from (irb):35
#        2: from (irb):35:in `dump'
#        1: from (irb):35:in `_dump'
#ArgumentError (year too big to marshal: 1899 UTC)

Marshal.dump(Time.new(1899))
#Traceback (most recent call last):
#        3: from (irb):37
#        2: from (irb):37:in `dump'
#        1: from (irb):37:in `_dump'
#ArgumentError (year too big to marshal: 1898 UTC)

Following commands will work fine:

Marshal.dump(Time.new(1901))
# => "\x04\bIu:\tTime\r\xF7/\x00\x80\x00\x00\x00\x00\a:\voffseti\x02\x10\x0E:\tzoneI\"\bCET\x06:\x06EF"

Marshal.dump(Date.new(1899))
# => "\x04\bU:\tDate[\vi\x00i\x03@\xD8$i\x00i\x00i\x00f\f2299161"

I'm in timezone CEST (UTC+2).

I tested it at MacOS High Sierra (10.13.6 (17G65)) and Ubuntu 16.04.5 LTS (GNU/Linux 4.4.0-135-generic x86_64) with two Ruby versions:

  • ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
  • ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-darwin17]

I expect that all Time objects can be marshaled, even if they are prior 1900.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0