|
|
| Perl-Sensitive Sunglasses | |
| PerlMonks |
Re^6: The most precise second (timer)by tukusejssirs (Beadle) |
| on Nov 28, 2019 at 11:33 UTC ( [id://11109358]=note: print w/replies, xml ) | Need Help?? |
|
Okay, I your point with the fixed times. I like the way you made the clock_nanosleep(CLOCK_REALTIME, ($now_s+1)*1e9, TIMER_ABSTIME);. In short tests (like for 10-20 s), the average diff is always 1.00000000000000000000, at least with the 5 decimal places the clock_gettime(CLOCK_REALTIME) outputs. Anyway, I am in the middle of 5 h run of the script; I’ll report the results when it is finished. Again, thanks for your time! Update: I have found out (using printf) that Update 2: I have the results of the 5-hour run of your script. I have calculated the difference as follows, but my calculations might be wrong, therefore here is the list of 18,000 time values. Note that the machine was not running only this script, because the timer (periodic runner) won’t be run as the only program on the server in production.
This is quite nice. I has already surpassed my assumptions. I’ve read the Time::HiRes readme, so I do not expect clock_nanosleep() to be exact down to one nanosecond, but the average results above tells me that that it is as least _nearly_ that accurate (at least on my system and its configuration). hawkex, I can’t thank you enough! You’re great!
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||