flexirecord 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/lib/flexirecord.rb +3 -3
- metadata +1 -1
data/CHANGELOG
CHANGED
@@ -52,3 +52,8 @@
|
|
52
52
|
PostgreSQL's types 'date', 'timestamp' and 'timestamptz' now get converted to a ruby Time object, when being read from the database. Ruby Time objects get converted to the following string representation, when being written to the database: 'YYYY-MM-DD HH:MM:SS.uuuuuu+/-hh', where hh is the offset in hours from UTC. This string can be (implicitly or explicitly) type casted by PostgreSQL to a Date/Time type.
|
53
53
|
|
54
54
|
- Release of version 1.0.0.
|
55
|
+
|
56
|
+
- 2007-03-02:
|
57
|
+
- >
|
58
|
+
Fixed a bug leading to wrong microseconds in timestamps read from the database.
|
59
|
+
|
data/lib/flexirecord.rb
CHANGED
@@ -1328,12 +1328,12 @@ module FlexiRecord
|
|
1328
1328
|
unless value_string =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})(\.([0-9]*))?$/
|
1329
1329
|
raise "Unexpected format for timestamp without time zone from database."
|
1330
1330
|
end
|
1331
|
-
Time.local($1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i, $8.to_i)
|
1331
|
+
Time.local($1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i, $8.to_i * 10 ** (6 - $8.to_s.length))
|
1332
1332
|
elsif data_type == "timestamptz"
|
1333
|
-
unless value_string =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})(\.([0-9]*))?([+-][0-9]{2})$/
|
1333
|
+
unless value_string =~ /^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})(\.([0-9]*))?( ?[+-][0-9]{2})$/
|
1334
1334
|
aise "Unexpected format for timestamp with time zone from database."
|
1335
1335
|
end
|
1336
|
-
(Time.utc($1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i, $8.to_i) - (3600 * $9.to_i)).localtime
|
1336
|
+
(Time.utc($1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i, $8.to_i * 10 ** (6 - $8.to_s.length)) - (3600 * $9.to_i)).localtime
|
1337
1337
|
else
|
1338
1338
|
value_string
|
1339
1339
|
end
|
metadata
CHANGED