1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 <2013> 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 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: time drift in camonitor timestamps |
From: | Eric Norum <[email protected]> |
To: | Ralph Lange <[email protected]>, Andrew Johnson <[email protected]> |
Cc: | EPICS Tech-Talk <[email protected]> |
Date: | Tue, 8 Jan 2013 09:46:14 -0800 |
This seems like it would be pretty easy to fix. --- dbScan.c 2011-12-12 12:14:45.000000000 -0800 +++ dbScan.c.proposed 2013-01-08 09:43:23.000000000 -0800 @@ -87,6 +87,7 @@ double period; volatile enum ctl scanCtl; epicsEventId loopEvent; + unsigned long overrunCount; } periodic_scan_list; static int nPeriodic = 0; @@ -542,18 +543,23 @@ { periodic_scan_list *ppsl = (periodic_scan_list *)arg; - epicsTimeStamp start_time, end_time; + epicsTimeStamp nextScan, now; double delay; taskwdInsert(0, NULL, NULL); epicsEventSignal(startStopEvent); + epicsTimeGetCurrent(&nextScan); while (ppsl->scanCtl != ctlExit) { - epicsTimeGetCurrent(&start_time); if (ppsl->scanCtl == ctlRun) scanList(&ppsl->scan_list); - epicsTimeGetCurrent(&end_time); - delay = ppsl->period - epicsTimeDiffInSeconds(&end_time, &start_time); - if (delay <= 0.0) delay = 0.1; + nextScan += ppsl->period; + epicsTimeGetCurrent(&now); + delay = epicsTimeDiffInSeconds(&nextScan, &now); + if (delay <= 0.0) { + ppsl->overrunCount++; + delay = 0.01; + epicsTimeGetCurrent(&nextScan); + } epicsEventWaitWithTimeout(ppsl->loopEvent, delay); } On Jan 8, 2013, at 8:51 AM, Ralph Lange <[email protected]> wrote:
|