#include <ctype.h>
#include <math.h>
+#include "common/string.h"
#include "pgtypeslib_extern.h"
#include "dt.h"
#include "pgtypes_timestamp.h"
for (i = 0; i < 6; i++)
fstr[i] = *cp != '\0' ? *cp++ : '0';
fstr[i] = '\0';
- *fsec = strtol(fstr, NULL, 10);
+ *fsec = strtoint(fstr, NULL, 10);
*cp = '\0';
len = strlen(str);
}
*tmask = 0;
- val = strtol(str, &cp, 10);
+ val = strtoint(str, &cp, 10);
if (cp == str)
return -1;
*tmask = DTK_TIME_M;
- tm->tm_hour = strtol(str, &cp, 10);
+ tm->tm_hour = strtoint(str, &cp, 10);
if (*cp != ':')
return -1;
str = cp + 1;
- tm->tm_min = strtol(str, &cp, 10);
+ tm->tm_min = strtoint(str, &cp, 10);
if (*cp == '\0')
{
tm->tm_sec = 0;
else
{
str = cp + 1;
- tm->tm_sec = strtol(str, &cp, 10);
+ tm->tm_sec = strtoint(str, &cp, 10);
if (*cp == '\0')
*fsec = 0;
else if (*cp == '.')
for (i = 0; i < 6; i++)
fstr[i] = *cp != '\0' ? *cp++ : '0';
fstr[i] = '\0';
- *fsec = strtol(fstr, &cp, 10);
+ *fsec = strtoint(fstr, &cp, 10);
if (*cp != '\0')
return -1;
}
int len;
/* assume leading character is "+" or "-" */
- hr = strtol(str + 1, &cp, 10);
+ hr = strtoint(str + 1, &cp, 10);
/* explicit delimiter? */
if (*cp == ':')
- min = strtol(cp + 1, &cp, 10);
+ min = strtoint(cp + 1, &cp, 10);
/* otherwise, might have run things together... */
else if (*cp == '\0' && (len = strlen(str)) > 3)
{
- min = strtol(str + len - 2, &cp, 10);
+ min = strtoint(str + len - 2, &cp, 10);
if (min < 0 || min >= 60)
return -1;
*(str + len - 2) = '\0';
- hr = strtol(str + 1, &cp, 10);
+ hr = strtoint(str + 1, &cp, 10);
if (hr < 0 || hr > 13)
return -1;
}
if (tzp == NULL)
return -1;
- val = strtol(field[i], &cp, 10);
+ val = strtoint(field[i], &cp, 10);
if (*cp != '-')
return -1;
char *cp;
int val;
- val = strtol(field[i], &cp, 10);
+ val = strtoint(field[i], &cp, 10);
/*
* only a few kinds are allowed to have an embedded