On 5/16/06, Markus Hoenicka <[EMAIL PROTECTED]> wrote:
Mike Rylander writes:
 > I'd be interested to see what the optimization was. :)
 >

I've replaced

if (strlen(*cur)) {

with

if (*cur) {


Cool.  Not sure why I didn't do that originally... :)

Saves us one function call. Whoohoo.

Besides, I've changed index() calls to strchr() calls just to make
the code consistent.


OK.  I've continued with strchr() ... more on that below.


 > >   04:05:06-08:00 (time)
 > >   1999-01-08 04:05:06 -8:00 (timestamp)
 >
 > It may just be a typo, but this is incorrect based on my original
 > patch.  I followed ISO8601 format for using numeric timezone
 > extentions on a timestamp, which requires the format of
 >
 > {+|-}hh[:mm]
 >

According to my tests both '-8:00' and '-08:00' work. '-0800' is
another option, whereas '-800' fails (correctly so). I did not change
the logic of your string parsing. Your patch is probably a bit more
forgiving than you thought. In any case, according to the PostgreSQL
docs all of the above notations that work conform to ISO8601.

Ahh..  I see.  Unfortunately, I believe that there is a bug here in my
original patch.  I'm looking at the total length of the timezone
string sans direction marker, and only if it is greater than 4 do I
assume there is a ':' minute separator.  If the length is exactly 4
then I am assuming the zero padded, four digit format.  This works
fine with complete hour offsets, but some timezones require half or
quarter hours, and the original patch won't work with those timezones
in the -8:00 format -- they will be split like this: -5:45  -->  (5:,
5), instead of (5, 45).

I've attached a patch against my local copy of the new file, so it
should patch CVS with out too much of a fight.  I've added a little
logic to look for a ':' minute separator in the -8:00 format.  It
compiles and runs for me, so please give it a whirl and make sure it
passes muster.

Thanks again for taking quick action on this, and being open to
patches from complete outsiders.  That's very encouraging!


regards,
Markus

--
Markus Hoenicka
[EMAIL PROTECTED]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de




--
Mike Rylander
[EMAIL PROTECTED]
GPLS -- PINES Development
Database Developer
http://open-ils.org

Attachment: libdbi-time_t-timezone-correction.patch
Description: Binary data

Reply via email to