2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 <2012> 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 | Index | 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 <2012> 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: timer delay compensation |
From: | Eric Norum <[email protected]> |
To: | Andrew Johnson <[email protected]> |
Cc: | EPICS core-talk <[email protected]> |
Date: | Thu, 14 Jun 2012 16:21:02 -0700 |
On Jun 14, 2012, at 3:52 PM, Andrew Johnson wrote:
But even so the '1 extra tick' problem wouldn't show up until around 8 million ticks (10^9 ticks ~= 30 bits, 53 bit double mantissa) so 9 9's it is. Here's the RTEMS implementation: void epicsThreadSleep (double seconds) { rtems_status_code sc; rtems_interval delay; extern double rtemsTicksPerSecond_double; if (seconds <= 0.0) { delay = 0; } else { /* * Low-overhead approximation of ceil() */ delay = seconds * rtemsTicksPerSecond_double + 0.999999999; } sc = rtems_task_wake_after (delay); if(sc != RTEMS_SUCCESSFUL) errlogPrintf("epicsThreadSleep: %s\n", rtems_status_text (sc)); } |