Hi all,

I just filed a bug in lighthouse for a bizarre timezone off-by-one with
reading timestamps from mysql.  It's blocking us severely right now, and I'm
about to dive into the dataobjects C code, where I believe the actual
problem to lie.  I'm not a wizard with all the locale stuff, so I'm hoping
to get more eyeballs on this and see if someone can see where I am being a
dunce and it's not a bug after all.

http://datamapper.lighthouseapp.com/projects/20609-datamapper/tickets/1487-timezone-inconsistency-w-do_mysql

Using DO 0.10.3 and DM 1.0.2, if I save a record with a timestamp to Mysql,
it gets written correctly inside the database, but when read back from the
db, the timezone is one off.

I reproduced this on Mac, Ruby 1.8.7; Mac, Ruby 1.9.2; Ubuntu, Ruby 1.8.7

The 1.8 output is
 ~ (0.000837) INSERT INTO `foos` (`created_at`) VALUES ('2011-02-14
16:05:13')
#<DateTime: 212164488313/86400,-1/3,2299161>
 ~ (0.000146) SELECT `id`, `created_at` FROM `foos` ORDER BY `id` LIMIT 1
#<DateTime: 212164484713/86400,-7/24,2299161>

The 1.9 output is
 ~ (0.000890) INSERT INTO `foos` (`created_at`) VALUES ('2011-02-14
16:24:59')
#<DateTime: 2011-02-14T16:24:59-08:00
(212164489499831587/86400000000,-1/3,2299161)>
 ~ (0.000187) SELECT `id`, `created_at` FROM `foos` ORDER BY `id` LIMIT 1
#<DateTime: 2011-02-14T16:24:59-07:00 (212164485899/86400,-7/24,2299161)>

This error is not present with sqlite3.

Thanks,
Gary

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to