-
Notifications
You must be signed in to change notification settings - Fork 1
datetime: supported parse of h's or m's frac part #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: tarantool-master-v1
Are you sure you want to change the base?
Conversation
- `datetime.c` `parse_tz_suffix` & it's clients refactored for better error detection & to simplify code: - offset value post condition check is moved to `parse_tz_suffix`. - this check uses tzoffset valid range instead of int16_t min/max. - offset arg type of `parse_tz_suffix` to valid for TZoffset int16_t. - The better error detection lead to assertion fails of datetime tests with decimal fraction of hours and minutes. So we need tarantool/c-dt#3. It's the first way to fix the problem which is mentioned in tarantool#12082. - datetime.c unit tests refactored. The number of tap test checks is being calculated using the lenght of test data tables. FIXME: need to update c-dt submodule hash. Requires tarantool/c-dt#3 Closes tarantool#12082 NO_DOC=FIXME, must have NO_CHANGELOG=FIXME, must have
- `datetime.c` `parse_tz_suffix` & it's clients refactored
for better error detection & to simplify code:
- offset value post condition check is moved to `parse_tz_suffix`.
- this check uses tzoffset valid range instead of int16_t min/max.
- offset arg type of `parse_tz_suffix` fixed
to valid for TZoffset int16_t.
- The better error detection lead to assertion fails of datetime tests
with decimal fraction of hours and minutes. So we need
tarantool/c-dt#3. It's the first way to fix the problem which
is mentioned in tarantool#12082.
- datetime.c unit tests refactored. The number of tap test checks
is being calculated using the lenght of test data tables.
FIXME: need to update c-dt submodule hash.
Requires tarantool/c-dt#3
Closes tarantool#12082
NO_DOC=FIXME, must have
NO_CHANGELOG=FIXME, must have
- `datetime.c` `parse_tz_suffix` & it's clients refactored
for better error detection & to simplify code:
- offset value post condition check is moved to `parse_tz_suffix`.
- this check uses tzoffset valid range instead of int16_t min/max.
- offset arg type of `parse_tz_suffix` fixed
to valid for TZoffset int16_t.
- The better error detection lead to assertion fails of datetime tests
with decimal fraction of hours and minutes. So we need
tarantool/c-dt#3. It's the first way to fix the problem which
is mentioned in tarantool#12082.
- datetime.c unit tests refactored to simpilfy it's support.
The number of tap test checks is being calculated
using the lenght of test data tables.
FIXME: need to update c-dt submodule hash.
Requires tarantool/c-dt#3
Closes tarantool#12082
NO_DOC=FIXME, must have
NO_CHANGELOG=FIXME, must have
- `datetime.c` `parse_tz_suffix` & it's clients refactored
for better error detection & to simplify code:
- offset value post condition check is moved to `parse_tz_suffix`.
- this check uses tzoffset valid range instead of int16_t min/max.
- offset arg type of `parse_tz_suffix` fixed
to valid for TZoffset int16_t.
- The better error detection lead to assertion fails of datetime tests
with decimal fraction of hours and minutes. So we need
tarantool/c-dt#3. It's the first way to fix the problem which
is mentioned in tarantool#12082.
- datetime.c unit tests refactored to simpilfy it's support.
The number of tap test checks is being calculated
using the lenght of test data tables.
FIXME: need to update c-dt submodule hash.
Requires tarantool/c-dt#3
Closes tarantool#12082
NO_DOC=FIXME, must have
NO_CHANGELOG=FIXME, must have
- `datetime.c` `parse_tz_suffix` & it's clients refactored
for better error detection & to simplify code:
- offset value post condition check is moved to `parse_tz_suffix`.
- this check uses tzoffset valid range instead of int16_t min/max.
- offset arg type of `parse_tz_suffix` fixed
to valid for TZoffset int16_t.
- The better error detection lead to assertion fails of datetime tests
with decimal fraction of hours and minutes. So we need
tarantool/c-dt#3. It's the first way to fix the problem which
is mentioned in tarantool#12082.
FIXME: need to update c-dt submodule hash.
Requires tarantool/c-dt#3
Closes tarantool#12082
NO_DOC=FIXME, must have
NO_CHANGELOG=FIXME, must have
4a3058f to
91c68e5
Compare
sergepetrenko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch!
LGTM.
- `datetime.c` `parse_tz_suffix` & it's clients refactored
for better error detection & to simplify code:
- offset value post condition check is moved to `parse_tz_suffix`.
- this check uses tzoffset valid range instead of int16_t min/max.
- offset arg type of `parse_tz_suffix` fixed
to valid for TZoffset int16_t.
- The better error detection lead to assertion fails of datetime tests
with decimal fraction of hours and minutes. So we need
tarantool/c-dt#3. It's the first way to fix the problem which
is mentioned in tarantool#12082.
FIXME: need to update c-dt submodule hash.
Requires tarantool/c-dt#3
Closes tarantool#12082
NO_DOC=FIXME, must have
NO_CHANGELOG=FIXME, must have
- `datetime.c` `parse_tz_suffix` & it's clients refactored
for better error detection & to simplify code:
- offset value post condition check is moved to `parse_tz_suffix`.
- this check uses tzoffset valid range instead of int16_t min/max.
- offset arg type of `parse_tz_suffix` fixed
to valid for TZoffset int16_t.
- The better error detection lead to assertion fails of datetime tests
with decimal fraction of hours and minutes. So we need
tarantool/c-dt#3. It's the first way to fix the problem which
is mentioned in tarantool#12082.
FIXME: need to update c-dt submodule hash.
Requires tarantool/c-dt#3
Closes tarantool#12082
NO_DOC=FIXME, must have
NO_CHANGELOG=FIXME, must have
- `datetime.c` `parse_tz_suffix` & it's clients refactored
for better error detection & to simplify code:
- offset value post condition check is moved to `parse_tz_suffix`.
- this check uses tzoffset valid range instead of int16_t min/max.
- offset arg type of `parse_tz_suffix` fixed
to valid for TZoffset int16_t.
- The better error detection lead to assertion fails of datetime tests
with decimal fraction of hours and minutes. So we need
tarantool/c-dt#3. It's the first way to fix the problem which
is mentioned in tarantool#12082.
FIXME: need to update c-dt submodule hash.
Requires tarantool/c-dt#3
Closes tarantool#12082
NO_DOC=FIXME, must have
NO_CHANGELOG=FIXME, must have
- `datetime.c` `parse_tz_suffix` & it's clients refactored
for better error detection & to simplify code:
- offset value post condition check is moved to `parse_tz_suffix`.
- this check uses tzoffset valid range instead of int16_t min/max.
- offset arg type of `parse_tz_suffix` fixed
to valid for TZoffset int16_t.
- The better error detection lead to assertion fails of datetime tests
with decimal fraction of hours and minutes. So we need
tarantool/c-dt#3. It's the first way to fix the problem which
is mentioned in tarantool#12082.
FIXME: need to update c-dt submodule hash.
Requires tarantool/c-dt#3
Closes tarantool#12082
NO_DOC=FIXME, must have
NO_CHANGELOG=FIXME, must have
- `datetime.c` `parse_tz_suffix` & it's clients refactored
for better error detection & to simplify code:
- offset value post condition check is moved to `parse_tz_suffix`.
- this check uses tzoffset valid range instead of int16_t min/max.
- offset arg type of `parse_tz_suffix` fixed
to valid for TZoffset int16_t.
- The better error detection lead to assertion fails of datetime tests
with decimal fraction of hours and minutes. So we need
tarantool/c-dt#3. It's the first way to fix the problem which
is mentioned in tarantool#12082.
FIXME: need to update c-dt submodule hash.
Requires tarantool/c-dt#3
Closes tarantool#12082
NO_DOC=FIXME, must have
NO_CHANGELOG=FIXME, must have
- `datetime.c` `parse_tz_suffix` & it's clients refactored
for better error detection & to simplify code:
- offset value post condition check is moved to `parse_tz_suffix`.
- this check uses tzoffset valid range instead of int16_t min/max.
- offset arg type of `parse_tz_suffix` fixed
to valid for TZoffset int16_t.
- The better error detection lead to assertion fails of datetime tests
with decimal fraction of hours and minutes. So we need
tarantool/c-dt#3. It's the first way to fix the problem which
is mentioned in tarantool#12082.
FIXME: UPDATE c-dt submodule hash TO COMMIT FROM tarantool/c-dt
Requires tarantool/c-dt#3
Closes tarantool#12082
NO_DOC=FIXME, must have
NO_CHANGELOG=FIXME, must have
- `datetime.c` `parse_tz_suffix` & it's clients refactored
for better error detection & to simplify code:
- offset value post condition check is moved to `parse_tz_suffix`.
- this check uses tzoffset valid range instead of int16_t min/max.
- offset arg type of `parse_tz_suffix` fixed
to valid for TZoffset (int16_t).
- The better error detection lead to assertion fails of datetime tests
with decimal fraction of hours and minutes. So we need
tarantool/c-dt#3. It's the first way to fix the problem which
is mentioned in tarantool#12082.
Requires tarantool/c-dt#3
Closes tarantool#12082
NO_DOC=bugfix
FIXME: UPDATE c-dt submodule hash TO COMMIT FROM tarantool/c-dt
- `datetime.c` `parse_tz_suffix` & it's clients refactored
for better error detection & to simplify code:
- offset value post condition check is moved to `parse_tz_suffix`.
- this check uses tzoffset valid range instead of int16_t min/max.
- offset arg type of `parse_tz_suffix` fixed
to valid for TZoffset (int16_t).
- The better error detection lead to assertion fails of datetime tests
with decimal fraction of hours and minutes. So we need
tarantool/c-dt#3. It's the first way to fix the problem which
is mentioned in tarantool#12082.
Requires tarantool/c-dt#3
Closes tarantool#12082
NO_DOC=bugfix
FIXME: UPDATE c-dt submodule hash TO COMMIT FROM tarantool/c-dt
- `datetime.c` `parse_tz_suffix` & it's clients refactored
for better error detection & to simplify code:
- offset value post condition check is moved to `parse_tz_suffix`.
- this check uses tzoffset valid range instead of int16_t min/max.
- offset arg type of `parse_tz_suffix` fixed
to valid for TZoffset (int16_t).
- The better error detection lead to assertion fails of datetime tests
with decimal fraction of hours and minutes. So we need
tarantool/c-dt#3. It's the first way to fix the problem which
is mentioned in tarantool#12082.
Requires tarantool/c-dt#3
Closes tarantool#12082
NO_DOC=bugfix
FIXME: UPDATE c-dt submodule hash TO COMMIT FROM tarantool/c-dt
ligurio
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch! Please see my comments.
dt_parse_iso.c
Outdated
| * hh | ||
| * hh.fffffffff | ||
| * hh,fffffffff | ||
| * hhmm | ||
| * hhmm.fffffffff | ||
| * hhmm,fffffffff | ||
| * hhmmss | ||
| * hhmmss.fffffffff | ||
| * hhmmss,fffffffff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please leave a comment with link to ISO 8601-1:2019, 5.3.1.4 where fractional part is described
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
dt_parse_iso.c
Outdated
| * hh,fffffffff | ||
| * hh:mm | ||
| * hh:mm.fffffffff | ||
| * hh:mm,fffffffff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as above: please leave a comment with link to standard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
t/parse_iso_time.c
Outdated
| { 1800, 0, "T00.5", 5 }, | ||
| { 450, 0, "T00.125", 7 }, | ||
| { 1199, 0, "T00.333333333", 13 }, | ||
| { 1800, 0, "T00,5", 5 }, | ||
| { 450, 0, "T00,125", 7 }, | ||
| { 1199, 0, "T00,333333333", 13 }, | ||
| { 30, 0, "T00:00.5", 8 }, | ||
| { 15, 0, "T00:00.25", 9 }, | ||
| { 7, 0, "T00:00.125", 10 }, | ||
| { 19, 0, "T00:00.333333333", 16 }, | ||
| { 30, 0, "T00:00,5", 8 }, | ||
| { 15, 0, "T00:00,25", 9 }, | ||
| { 7, 0, "T00:00,125", 10 }, | ||
| { 19, 0, "T00:00,333333333", 16 }, | ||
| { 30, 0, "T0000.5", 7 }, | ||
| { 15, 0, "T0000.25", 8 }, | ||
| { 7, 0, "T0000.125", 9 }, | ||
| { 19, 0, "T0000.333333333", 15 }, | ||
| { 30, 0, "T0000,5", 7 }, | ||
| { 15, 0, "T0000,25", 8 }, | ||
| { 7, 0, "T0000,125", 9 }, | ||
| { 19, 0, "T0000,333333333", 15 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get how you chose a number for a fractional part.
I would check max (999999999), min (000000000) and average (any number in (0, 999999999)), and your choice: 5, 24, 125 and 333333333.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added min/max values.
t/parse_iso_time.c
Outdated
| { 1800, 0, "T00.5", 5 }, | ||
| { 450, 0, "T00.125", 7 }, | ||
| { 1199, 0, "T00.333333333", 13 }, | ||
| { 1800, 0, "T00,5", 5 }, | ||
| { 450, 0, "T00,125", 7 }, | ||
| { 1199, 0, "T00,333333333", 13 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for unknown reasons .25 is missed for both formats
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
| @@ -24,6 +24,7 @@ | |||
| * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please link to standard (ISO 8601-1:2019, 5.3.1.4) in the commit message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
t/parse_iso_time.c
Outdated
| { 1800, 0, "T00,5", 5 }, | ||
| { 450, 0, "T00,125", 7 }, | ||
| { 1199, 0, "T00,333333333", 13 }, | ||
| { 30, 0, "T00:00.5", 8 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should these tests fail?
--- a/t/parse_iso_time.c
+++ b/t/parse_iso_time.c
@@ -125,10 +125,10 @@ const struct good_t {
{ 0, 0, "T000000.000000000", 17 },
{ 1800, 0, "T00.5", 5 },
{ 450, 0, "T00.125", 7 },
- { 1199, 0, "T00.333333333", 13 },
+ { 1199, 0, "T00.3333333331", 14 },
{ 1800, 0, "T00,5", 5 },
{ 450, 0, "T00,125", 7 },
- { 1199, 0, "T00,333333333", 13 },
+ { 1199, 0, "T00,3333333331", 14 },
{ 30, 0, "T00:00.5", 8 },
{ 15, 0, "T00:00.25", 9 },
{ 7, 0, "T00:00.125", 10 },now tests passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More than 9 fraction digits is truncated. Comments added.
Here is the case with 10 digits (line 60):
Lines 58 to 60 in edeaa5f
| { 0, 999999990, "T00:00:00.99999999", 18 }, | |
| { 0, 999999999, "T00:00:00.999999999", 19 }, | |
| { 0, 999999999, "T00:00:00.9999999999", 20 }, |
Similar tests added.
hh.hh & hhmm.mm parsing in dt_iso_parse.c implemented. Such formats are defined in ISO 8601-1:2019 (5.3.1.4). They are used in tarantool datetime tests. Need for tarantool/tarantool#12082 tarantool/tarantool#12083
hh.hh & hhmm.mm parsing in dt_iso_parse.c implemented.
Such formats are defined in ISO 8601-1:2019 (5.3.1.4).
They are used in tarantool datetime tests.
Need for tarantool/tarantool#12082 tarantool/tarantool#12083