Use of UTC offset in DO adapters

8 views
Skip to first unread message

Luis Lavena

unread,
May 28, 2008, 12:39:59 PM5/28/08
to datam...@googlegroups.com
Hello Guys,

Latest changes in DO adapters includes usage of UTC offset
calculations using tm_gmtoff member of tm structure, which is not part
of the CRT for OS outside posix.

That imposes a problem for me to compile the latest version of the
adapters, since I'm on Windows.

Was working on a patch lastnight but can't continue doing it since I'm
overloaded by daily job tasks (maybe can take a look during weekend).

I was thinking someone can implement a cross-platform utc_offset
function? Right now the code used is here:

http://github.com/sam/do/tree/master/do_mysql/ext/do_mysql_ext.c#L197-L213

And also another "offset in seconds" here:

http://github.com/sam/do/tree/master/do_mysql/ext/do_mysql_ext.c#L231

Basically, that can be extracted and implemented in a way similar
time.c from Ruby itself is done:

http://pastie.caboo.se/204794

Any takers?

--
Luis Lavena
AREA 17
-
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams

Sam Smoot

unread,
May 28, 2008, 7:57:03 PM5/28/08
to DataMapper
On May 28, 11:39 am, "Luis Lavena" <luislav...@gmail.com> wrote:
> Hello Guys,
>
> Latest changes in DO adapters includes usage of UTC offset
> calculations using tm_gmtoff member of tm structure, which is not part
> of the CRT for OS outside posix.
>
> That imposes a problem for me to compile the latest version of the
> adapters, since I'm on Windows.
>
> Was working on a patch lastnight but can't continue doing it since I'm
> overloaded by daily job tasks (maybe can take a look during weekend).
>
> I was thinking someone can implement a cross-platform utc_offset
> function? Right now the code used is here:
>
> http://github.com/sam/do/tree/master/do_mysql/ext/do_mysql_ext.c#L197...
>
> And also another "offset in seconds" here:
>
> http://github.com/sam/do/tree/master/do_mysql/ext/do_mysql_ext.c#L231
>
> Basically, that can be extracted and implemented in a way similar
> time.c from Ruby itself is done:
>
> http://pastie.caboo.se/204794
>
> Any takers?
>
> --
> Luis Lavena
> AREA 17
> -
> Human beings, who are almost unique in having the ability to learn from
> the experience of others, are also remarkable for their apparent
> disinclination to do so.
> Douglas Adams

Thanks for the heads-up Luis! If nobody manages to get to this before
next week, we'll have a few cycles to spare in the office so I can
dedicate someone to the task.

-Sam

Bernerd Schaefer

unread,
Jun 3, 2008, 6:49:02 PM6/3/08
to datam...@googlegroups.com
I threw together a ticket for this on Lighthouse.

http://wm.lighthouseapp.com/projects/4819/tickets/339-windows-utf-offset

I did a little bit of research and tried something for do_postgres. If
someone wants to try applying the patch and running it on Windows,
that would be great.

Bernerd Schaefer

Luis Lavena

unread,
Jun 5, 2008, 7:42:26 PM6/5/08
to datam...@googlegroups.com

I just replied to this ticket (dunno was being marked as spam).

Anyway, if you have your system on Greenwich timezone (+0) the specs
fails. If you have your timezone in +1 (like I do now) it fails but
only one spec.

If you move into a negative timezone (anything left of Greenwich
meridian I get 2 failures...

I'll see when I can get time to work on this, but please feel free to
takle this task since you was in the good patch (er, I mean path!)

Luis Lavena

unread,
Jun 10, 2008, 8:22:55 AM6/10/08
to datam...@googlegroups.com
On Fri, Jun 6, 2008 at 1:42 AM, Luis Lavena <luisl...@gmail.com> wrote:
> On Wed, Jun 4, 2008 at 12:49 AM, Bernerd Schaefer <bj.sc...@gmail.com> wrote:
>>
>> I threw together a ticket for this on Lighthouse.
>>
>> http://wm.lighthouseapp.com/projects/4819/tickets/339-windows-utf-offset
>>
>> I did a little bit of research and tried something for do_postgres. If
>> someone wants to try applying the patch and running it on Windows,
>> that would be great.
>>
>
> I just replied to this ticket (dunno was being marked as spam).
>
> Anyway, if you have your system on Greenwich timezone (+0) the specs
> fails. If you have your timezone in +1 (like I do now) it fails but
> only one spec.
>
> If you move into a negative timezone (anything left of Greenwich
> meridian I get 2 failures...
>
> I'll see when I can get time to work on this, but please feel free to
> takle this task since you was in the good patch (er, I mean path!)
>

Followup to ticket:

http://wm.lighthouseapp.com/projects/4819/tickets/339-windows-utf-offset#ticket-339-9

If I comment out the is_dst condition (if is_dst > 0) it works for any
timezone, negative, zero and possitive, with or without daylight
saving.

FYI,

Reply all
Reply to author
Forward
0 new messages