mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-21 02:20:55 +00:00
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m
(newValueForDateTypeLengthAttribute): Correct determination of seconds and milliseconds. Make optimization explicit. [BUG:19503 reported by Manuel Guesdon]. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@25060 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
74ad3ed78b
commit
31f0adba83
2 changed files with 15 additions and 21 deletions
|
@ -1,3 +1,10 @@
|
|||
2007-04-16 David Ayers <ayers@fsfe.org>
|
||||
|
||||
* EOAdaptors/PostgreSQLAdaptor/PostgreSQLChannel.m
|
||||
(newValueForDateTypeLengthAttribute): Correct determination
|
||||
of seconds and milliseconds. Make optimization explicit.
|
||||
[BUG:19503 reported by Manuel Guesdon].
|
||||
|
||||
2007-03-10 David Ayers <ayers@fsfe.org>
|
||||
|
||||
* EOAdaptors/SQLiteAdaptor/LoginPanel/Makefile.postamble:
|
||||
|
|
|
@ -369,6 +369,7 @@ newValueForDateTypeLengthAttribute (const void *bytes,
|
|||
NSCalendarDate *date = nil;
|
||||
const char *str = bytes;
|
||||
BOOL error;
|
||||
char tmpString[8];
|
||||
|
||||
/* We assume ISO date format:
|
||||
2006-12-31 00:45:21.2531419+01
|
||||
|
@ -376,61 +377,47 @@ newValueForDateTypeLengthAttribute (const void *bytes,
|
|||
where the milliseconds have variable length. */
|
||||
if (length > 3)
|
||||
{
|
||||
char tmpString[5];
|
||||
getDigits(&str[0],tmpString,4,&error);
|
||||
year = atoi(tmpString);
|
||||
}
|
||||
|
||||
if (length > 6)
|
||||
{
|
||||
char tmpString[3];
|
||||
getDigits(&str[5],tmpString,2,&error);
|
||||
month = atoi(tmpString);
|
||||
}
|
||||
|
||||
if (length > 9)
|
||||
{
|
||||
char tmpString[3];
|
||||
getDigits(&str[8],tmpString,2,&error);
|
||||
day = atoi(tmpString);
|
||||
}
|
||||
|
||||
if (length > 12)
|
||||
{
|
||||
char tmpString[3];
|
||||
getDigits(&str[11],tmpString,2,&error);
|
||||
hour = atoi(tmpString);
|
||||
}
|
||||
|
||||
if (length > 15)
|
||||
{
|
||||
char tmpString[3];
|
||||
getDigits(&str[14],tmpString,2,&error);
|
||||
minute = atoi(tmpString);
|
||||
}
|
||||
|
||||
if (length > 18)
|
||||
{
|
||||
char tmpString[3];
|
||||
getDigits(&str[17],tmpString,2,&error);
|
||||
second = atoi(tmpString);
|
||||
}
|
||||
|
||||
if (length > 18)
|
||||
{
|
||||
char tmpString[3];
|
||||
getDigits(&str[17],tmpString,2,&error);
|
||||
second = atoi(tmpString);
|
||||
}
|
||||
if (length > 19)
|
||||
{
|
||||
char tmpString[8];
|
||||
tz = getDigits(&str[17],tmpString,7,&error);
|
||||
second = atoi(tmpString);
|
||||
millisecond = atoi(tmpString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tz)
|
||||
{
|
||||
char tmpString[3];
|
||||
int sign = (str[tz]) == '-' ? -1 : 1;
|
||||
getDigits(&str[tz+1],tmpString,2,&error);
|
||||
tz = atoi(tmpString);
|
||||
|
|
Loading…
Reference in a new issue