We're on the west coast. In Ubuntu, I configure via:
ln -s /usr/share/zoneinfo/America/Los_Angeles localtime
I don't have TZ set in the env.
The relevant code appears to be in do_mysql.c#parse_date_time:
tzset();
...
timeinfo.tm_isdst = -1;
// Update tm_isdst
mktime(&timeinfo);
if (timeinfo.tm_isdst) {
dst_adjustment = 3600;
} else {
dst_adjustment = 0;
}
...
if (dst_adjustment) {
gmt_offset += dst_adjustment;
}
I'll check out the github changes.
-Gary
On Mon, Feb 14, 2011 at 5:09 PM, Ted Han <[email protected]> wrote:
> Hey Gary,
>
> This has actually been a topic of conversation the past couple of days,
> please check out the changes in the DO repository for do_mysql:
> https://github.com/datamapper/do/commit/9e369b79888abd4a3e7b4fd63ac32a38959e7e16
>
> Please do try using do_mysql edge and see if that addresses your issues.
>
> Also, could you please let us know what time zone you are in?
>
> Cheers,
>
> -Ted
>
> On Mon, Feb 14, 2011 at 7:47 PM, Gary Yngve <[email protected]> wrote:
>
>> 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.
>>
>
> --
> 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.
>
--
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.