Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: Re: pyEpics time stamps
From: Mark Rivers <rivers@cars.uchicago.edu>
To: Eric Norum <wenorum@lbl.gov>
Cc: EPICS mailing list <tech-talk@aps.anl.gov>
Date: Tue, 13 May 2014 00:06:36 +0000
Matt Newville is maintaining it. I think he is at ESRF right now.

Mark

Sent from my iPhone

On May 12, 2014, at 6:39 PM, "Eric Norum" <wenorum@lbl.gov<mailto:wenorum@lbl.gov>> wrote:

I’ve found the problem — the code in lib/dbr.py looks just plain wrong:
EPICS2UNIX_EPOCH = 631173600.0 - time.timezone
. . .
def make_unixtime(stamp):
    "UNIX timestamp (seconds) from Epics TimeStamp structure"
    return (EPICS2UNIX_EPOCH + stamp.secs + 1.e-6*int(1.e-3*stamp.nsec))

Problem one — that constant is wrong.  The correct value, as defined in <base>/include/epicsTime.h is: #define POSIX_TIME_AT_EPICS_EPOCH 631152000u
Problem two — what’s ‘time.timezone’ doing in there?   The unix time stamp is in UTC as is the EPICS time stamp.

I propose the following fix:
diff -u lib/dbr.py.orig lib/dbr.py
--- lib/dbr.py.orig 2014-05-12 16:37:58.000000000 -0700
+++ lib/dbr.py 2014-05-12 16:38:00.000000000 -0700
@@ -66,7 +66,7 @@
 MAX_ENUM_STRING_SIZE = 26
 MAX_ENUMS            = 16



-EPICS2UNIX_EPOCH = 631173600.0 - time.timezone
+EPICS2UNIX_EPOCH = 631152000.0



 # create_subscription mask constants
 DBE_VALUE = 1


Who’s maintaining the pyEpics stuff now?
--
Eric Norum
wenorum@lbl.gov<mailto:wenorum@lbl.gov>




References:
pyEpics time stamps Eric Norum
Re: pyEpics time stamps Eric Norum

Navigate by Date:
Prev: Re: pyEpics time stamps Eric Norum
Next: about CSS BOY 岳敏
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019 
Navigate by Thread:
Prev: Re: pyEpics time stamps Eric Norum
Next: Re: pyEpics time stamps Matt Newville
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019 
ANJ, 17 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·