Skip to content

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
Development

Successfully merging this pull request may close these issues.

1 participant