Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions db/types.c
Original file line number Diff line number Diff line change
Expand Up @@ -7262,7 +7262,7 @@ static int _isISO8601(const char *str, int len)
/* (month<1 || month>12)*/ \
\
/*get day*/ \
day = getInt(in, len, &offset, &ltoken, 1, 2, "-T", &skipped); \
day = getInt(in, len, &offset, &ltoken, 1, 2, "-T ", &skipped); \
if (!ltoken) \
return CONV_WRONG_MDAY; \
/*(day <1 || !is_valid_days(year, month, day))*/ \
Expand Down Expand Up @@ -7307,8 +7307,14 @@ static int _isISO8601(const char *str, int len)
ss = 0; \
} else \
mm = 0; \
} else \
} else { \
hh = 0; \
/* Need to compensate if the last separator is a space */ \
/* Because we expect the timezone string to have a leading space */ \
/* See a few lines above for the same logic in parsing the fraction */ \
if (in[offset - 1] == ' ') \
offset--; /*incremented afterwards*/ \
} \
\
/* fill in the blanks*/ \
out->tm.tm_year = year - 1900; \
Expand Down
6 changes: 6 additions & 0 deletions tests/datetime.test/t25.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(rows inserted=1)
(rows inserted=1)
(d="1970-01-01T000000.000 UTC")
(d="1970-08-17T001501.000 UTC")
(epoch=0)
(epoch=19700101)
8 changes: 8 additions & 0 deletions tests/datetime.test/t25.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SET TIMEZONE UTC
DROP TABLE IF EXISTS t25
CREATE TABLE t25(d datetime)$$
INSERT INTO t25 VALUES("1970-01-01 00:00:00 UTC")
INSERT INTO t25 VALUES("19700101")
SELECT d FROM t25
SELECT CAST(d AS INT) AS epoch FROM t25
DROP TABLE t25
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/udf.test/runit
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -x
for t in *.req; do
for t in `ls *.req | sort`; do
cdb2sql --tabs --script --cdb2cfg ${CDB2_CONFIG} ${1} default - 2> ${t}.output 1>&2 < ${t}
set -e
diff ${t}.expected ${t}.output
Expand Down