Forum > Networking and Web Programming

cannot receive messages; udp server with lnet

<< < (44/44)

rvk:

--- Quote from: Warfley on July 14, 2022, 01:58:50 pm ---Ah you are right, I confused them with the FunctioNameEx functions.
The API for this is https://docs.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timegetdevcaps

--- End quote ---
The TimeGetDevCaps only shows the min and max value. Not the current value.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---_timecaps = packed Record  wPeriodMin: UINT;  wPeriodMax: UINT;end;
This doesn't give me a different value after doing TimeBeginPeriod(1), which I would expect because it does fix the sleep(1).


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  TCaps: TTimeCaps; // WinAPI.MMSystem;  rc: MMResult; begin   rc := timeGetDevCaps(@TCaps, SizeOf(TCaps)); // WinAPI.MMSystem;  if rc = 0   then Writeln(Format('Min %d / Max %d', [TCaps.wPeriodMin, TCaps.wPeriodMax]))    else Writeln(Format('timeGetDevCaps returned %d', [rc]));   TimeBeginPeriod(1);   rc := timeGetDevCaps(@TCaps, SizeOf(TCaps)); // WinAPI.MMSystem;  if rc = 0   then Writeln(Format('Min %d / Max %d', [TCaps.wPeriodMin, TCaps.wPeriodMax]))    else Writeln(Format('timeGetDevCaps returned %d', [rc]));

--- Quote ---Min 1 / Max 1000000
Min 1 / Max 1000000
--- End quote ---

SymbolicFrank:
Yes, that clockres program and the powercfg report are very interesting. And it nicely explains why it is so inconsistent:

- It depends on which application has set the lowest timer.
- It is rounded up or down from the last timer tick.
- Some Windows versions try to emulate a slower timer by waiting approximately 15.6 ms by skipping interrupts. That also means that they're not running in sync.
- Some Linuxes use a free running scheduler, which impacts VM's.

In short: it depends. Don't count on it taking a specific time.


Btw. The only good way to measure time in such cases is by using the functions that return the current CPU cycle count. Or an external RTC.

On second thought: the CPU cycle count depends on the power saving, so an external clock source is the only reliable way.

Navigation

[0] Message Index

[*] Previous page

Go to full version