Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  <19951996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  Index 1994  <19951996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
<== Date ==> <== Thread ==>

Subject: R3.12 EPICS BUG Report (CA fails under HPUX)
From: hill@luke.atdiv.lanl.gov (Jeff Hill)
To: tech-talk@aps.anl.gov
Date: Tue, 1 Aug 95 09:45:58 MDT

R3.12 BUG Report (CA fails under HPUX)

SYMPTOM: 
CA client never connects under HPUX. Problem has not been reported 
on other OS.

FIX: 
Install the attached replacement for cac_time_diff() into
base/src/ca/access.c

A patch to R3.12 is pending creation of a CVS branch at APS.

EXPLANATION:
This problem stems from a fundamental difference between
the timeval data structure under under HPUX and under other 
OS such as SUNOS4:

HP UX:
struct timeval {
        unsigned long tv_sec;         /* seconds */
        long          tv_usec;        /* and microseconds */
};

SUNOS4:
struct timeval {
        long    tv_sec;         /* seconds */
        long    tv_usec;        /* and microseconds */
};

CA isnt expecting tv_sec to be unsigned. When it is unsigned
this causes a drastic change in the arithmetic in cac_time_diff().

Of course all of this results from there being no way to fetch
sub sec granularity time in POSIX. The result is we end up calling
the defacto standard BSD gettimeofday() which uses struct timeval.

Jeff

/*
 * cac_time_diff()
 */
ca_real cac_time_diff (ca_time *pTVA, ca_time *pTVB)
{
        ca_real         delay;
        ca_real         udelay;

        /*
         * works with unsigned tv_sec in struct timeval
         * under HPUX
         */
        if (pTVA->tv_sec>pTVB->tv_sec) {
                delay = pTVA->tv_sec - pTVB->tv_sec;
        }
        else {
                delay = pTVB->tv_sec - pTVA->tv_sec;
                delay = -delay;
        }

        if(pTVA->tv_usec>pTVB->tv_usec){
                udelay = pTVA->tv_usec - pTVB->tv_usec;
        }
        else{
                delay -= 1.0;
                udelay = (USEC_PER_SEC - pTVB->tv_usec) + pTVA->tv_usec;
        }
        delay += udelay / USEC_PER_SEC;

        return delay;
}

______________________________________________________________________
Jeffrey O. Hill			Internet	johill@lanl.gov
LANL MS H820			Voice		505 665 1831
Los Alamos, NM 87545 USA 	FAX		505 665 5107


Navigate by Date:
Prev: SNL reconnects across CA Andy Foster
Next: Re: error in compiling xmca Ben-chin K. Cha
Index: 1994  <19951996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
Navigate by Thread:
Prev: SNL reconnects across CA Andy Foster
Next: default.dctsdr Marty Kraimer
Index: 1994  <19951996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·