On 12/04/17 19:08, Stefan Dösinger wrote:
Am 2017-12-04 um 18:43 schrieb Piotr Caban:
I wonder if native works well if time difference doesn't fit into ULONG, did you check that?
With native the app works fine. I haven't tested if the app passes the same parameters with native. Extending the existing tests in msvcp120/tests also seems to work.
(_Cnd_timedwait just sits there and waits, instead of returning with timeout immediately. I obviously haven't waited 30 days to see if it times out then)
If it doesn't - the simplest fix would be to do something like this> timeout.QuadPart = (ULONGLONG)((ULONG)_Xtime_diff_to_millis(xt)) * -10000;
This works, but I could swear I tried that myself and it didn't work then - hence my wondering of casts vs assignments.
I've done some testing and native behaves badly when waiting for ~49 days (in this case the _Xtime_diff_to_millis overflows ULONG). So it looks that if we want to be bug-to-bug compatible we should use _Xtime_diff_to_millis and cast it to ULONG.
I'm attaching a test I've used. The test waits shortly with native while it's asked to wait for ~49 days.
Thanks, Piotr