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: pyEpics time stamps |
From: | Eric Norum <[email protected]> |
To: | EPICS mailing list <[email protected]> |
Date: | Mon, 12 May 2014 16:39:42 -0700 |
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 [email protected] |