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: epicsTimer and rounding |
From: | Eric Norum <[email protected]> |
To: | Ralph Lange <[email protected]> |
Cc: | EPICS Core Talk <[email protected]>, Dirk Zimoch <[email protected]> |
Date: | Fri, 8 Jun 2012 11:13:08 -0700 |
I see that these semantics have already been described -- mail was out here for about 3 hours thus my comments seem a little anachronistic now…. So -- is this the right implementation for RTEMS? It adds an int->float conversion and a float comparison, but I can't see anything simpler. void epicsThreadSleep (double seconds) { rtems_status_code sc; rtems_interval delay; double xDelay; extern double rtemsTicksPerSecond_double; if (seconds <= 0.0) { delay = 0; } else { delay = xDelay = seconds * rtemsTicksPerSecond_double; if (delay != xDelay) delay++; } sc = rtems_task_wake_after (delay); if(sc != RTEMS_SUCCESSFUL) errlogPrintf("epicsThreadSleep: %s\n", rtems_status_text (sc)); } -- Eric Norum [email protected]