Skip to content
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

Timestamp fractional seconds internal oracle representation. #66

Open
acautin opened this issue Sep 1, 2018 · 5 comments
Open

Timestamp fractional seconds internal oracle representation. #66

acautin opened this issue Sep 1, 2018 · 5 comments
Assignees
Labels

Comments

@acautin
Copy link
Contributor

acautin commented Sep 1, 2018

Hi I am seeing wrong results when using oci_util:from_dts/1 function for the fractional part. The problem seems to be matching using little endian instead of big when decoding the value.

Also #5 doesn't seem to be correct as I can read the data in binary format.

@c-bik
Copy link
Member

c-bik commented Sep 1, 2018

@acautin

In

, Ns:4/little-unsigned-integer-unit:8>>
and
, Ns:4/little-unsigned-integer-unit:8, TzH:1/integer-unit:8, TzM:1/integer-unit:8>>
...is it giving you correct result if you replace Ns:4/little-unsigned-integer-unit:8 with Ns:4/big-unsigned-integer-unit:8

@c-bik
Copy link
Member

c-bik commented Sep 1, 2018

#5 is an old a bug, it probably doesn't apply any more. I will try to verify and close that later!
👍 for find it!

@c-bik
Copy link
Member

c-bik commented Sep 1, 2018

Also need to update this test case with better verification for correctness of API

erloci/test/erloci_test.erl

Lines 963 to 966 in 480fe13

{{C2Y,C2M,C2D}, {C2H,C2Min,C2S}} = oci_util:from_dts(C2),
{{C3Y,C3M,C3D}, {C3H,C3Min,C3S}, C3Ns} = oci_util:from_dts(C3),
{{C4Y,C4M,C4D}, {C4H,C4Min,C4S}, C4Ns, {C4TzH,C4TzM}} = oci_util:from_dts(C4),
{{C5Y,C5M,C5D}, {C5H,C5Min,C5S}, C5Ns} = oci_util:from_dts(C5),

Currently API correctness isn't checked.

@acautin
Copy link
Contributor Author

acautin commented Sep 1, 2018

For the fractional part (Which was what I was interested at the moment) yes it gives me the correct results if I use big there. For now I am using only the datetime conversion taking the first 7 bytes and adding the fraction (if there is any) myself. We can replace it later when this is fixed. https://github.com/K2InformaticsGmbH/dderl/blob/master/src/dderloci_utils.erl#L142-L146

@c-bik
Copy link
Member

c-bik commented Sep 2, 2018

This will deprecate most of oci_util APIs

For example:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants