Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

avoid date change on serielizing

  • Loading branch information...
commit 659b763aacb8ff1a16f6b2d7aeacd8156022990a 1 parent 2284643
Leon Li authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/rocketamf/pure/serializer.rb
View
6 lib/rocketamf/pure/serializer.rb
@@ -67,7 +67,7 @@ def write_string str, stream
def write_date date, stream
stream << AMF0_DATE_MARKER
- date.utc unless date.utc?
+ date = date.getutc
seconds = (date.to_f * 1000).to_i
stream << pack_double(seconds)
@@ -161,6 +161,8 @@ def serialize obj, stream = ""
write_string obj.to_s, stream
elsif obj.is_a?(Time)
write_date obj, stream
+ elsif obj.is_a?(Date)
+ write_date obj.to_time, stream
elsif obj.is_a?(StringIO)
write_byte_array obj, stream
elsif obj.is_a?(RocketAMF::Values::ArrayCollection)
@@ -218,7 +220,7 @@ def write_date date, stream
@object_cache.add_obj date
# Build AMF string
- date.utc unless date.utc?
+ date = date.getutc unless date.utc?
seconds = (date.to_f * 1000).to_i
stream << pack_integer(AMF3_NULL_MARKER)
stream << pack_double(seconds)
Please sign in to comment.
Something went wrong with that request. Please try again.