Skip to content

Fix loss of precision with BigDateTime - #219

Open
lanfeust69 wants to merge 1 commit into
DataAction:masterfrom
lanfeust69:fix-big-datetime
Open

lanfeust69 wants to merge 1 commit into
DataAction:masterfrom
lanfeust69:fix-big-datetime

Conversation

@lanfeust69

Copy link
Copy Markdown

We should ensure as much as possible a correct round-trip with DateTime.
Since DateTime has a higher precision (1/10 µs instead of 1 µs), this is
the limit, but we can avoid truncating microseconds.

We should ensure as much as possible a correct round-trip with DateTime.
Since DateTime has a higher precision (1/10 µs instead of 1 µs), this is
the limit, but we can avoid truncating microseconds.
@Ju42

Ju42 commented Feb 24, 2023

Copy link
Copy Markdown

Hello @zoechelvaraj is this project still maintained ? I see that you accepted this PR a year ago but it's still waiting to be merged

@tangocoder

Copy link
Copy Markdown

Indeed, I'd like to see this PR merged

@alaricd

alaricd commented Oct 18, 2026

Copy link
Copy Markdown

I ran this against a live server and it fixes both problems. Setup: ASE 16.0 SP02 PL02 (the nguoianphu/docker-sybase image), AseClient master with this branch applied on top (it applies cleanly).

before with this PR
read a stored 13:45:30.123456 from a BIGDATETIME 13:45:30.1229952 13:45:30.1234560
write DateTime 13:45:30.1234560 through an AseDbType.BigDateTime parameter, then CONVERT(varchar, col, 140) .123000 (microseconds dropped, as originally reported) 13:45:30.123456
read that written value back through the driver n/a 13:45:30.1234560

The "before" row is the stock 0.19.2 behavior (the read figure was re-checked today; the write figure is from our earlier run of the same scenario). The decoding error in the read case comes from going through milliseconds and a double (TimeSpan.FromMilliseconds); counting ticks as this PR does is exact.

Related, separate change: #241 adds reading of BIGTIME, which currently throws "Unsupported data type 188".

Found while testing for a release of https://github.com/pengdows/pengdows.crud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants