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

Decrease the resolution of 'sessionend' according to the rounding error of date2num and num2date #463

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Tzion
Copy link

@Tzion Tzion commented Jan 5, 2022

The precision of 'roundtrip' conversion of datetime [i.e: num2date(date2num(datetime)) ] is 10 microseconds.
Therefore to prevent bug when performing double conversion of dates,
the resolution needs to be in order of magnitude lower - i.e. 100 ms.

Example: num2date(date2num(datetime(2021,3,12, 4,59,59,999990))) will be
rounded and return 2021-03-12_05:00:00.000000
This is bad because the round error percolated up to the Hours. In some cases (e.g. timezone is involved) this error can go up to Days - and shift the date by one day.

…date2num and num2date;

The precision of 'roundtrip' conversion of datetime [i.e: num2date(date2num(datetime)) ] is 10 microseconds.
therefore to prevent bug when performing double conversion of dates,
the resolution needs to be in order of magnitude lower - i.e. 100 ms.
Example: num2date(date2num(datetime(2021,3,12, 4,59,59,999990))) will be
rounded and return 2021-03-12_05:00:00.000000.
@Tzion Tzion changed the title decrease the precision of 'sessionend' according the rounding error of date2num and num2date decrease the resolution of 'sessionend' according the rounding error of date2num and num2date Jan 5, 2022
@Tzion Tzion changed the title decrease the resolution of 'sessionend' according the rounding error of date2num and num2date Decrease the resolution of 'sessionend' according the rounding error of date2num and num2date Jan 5, 2022
@Tzion Tzion changed the title Decrease the resolution of 'sessionend' according the rounding error of date2num and num2date Decrease the resolution of 'sessionend' according to the rounding error of date2num and num2date Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant