EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  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  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: cothread time stamp problem
From: "Shen, Guobao" <[email protected]>
To: "[email protected]" <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Sat, 11 Feb 2012 03:58:47 +0000
Hi Michael,
What is the time policy used in cothread to retrieve ioc time stamp?
I am using cothread 2.3, and found the time is shifted by a constant value relative to local timezone.
For example, in US EST time, to get time stamp in Python, I use val = caget(pv, format=FORMAT_TIME).
However, the time.localtime(val.timestamp)=real local time + 5 hours, and 
time.gmtime(val.timestamp) = real local time + 10 hours = real UTC time + 5 hours,
which looks shifting to wrong direction.

Here is my test case:

$ caget -d 20 test
test
    Native data type: DBF_DOUBLE
    Request type:     DBR_TIME_DOUBLE
    Element count:    1
    Value:            1.9
    Timestamp:        2012-02-10 15:27:21.645387
    Status:           NO_ALARM
    Severity:         NO_ALARM

$ python
...
>>> from cothread.catools import *
>>> import time
>>> v=caget('test', format=FORMAT_TIME)
>>> time.localtime(v.timestamp)
time.struct_time(tm_year=2012, tm_mon=2, tm_mday=10, tm_hour=20, tm_min=27, tm_sec=21, tm_wday=4, tm_yday=41, tm_isdst=0)
>>> time.gmtime(v.timestamp)
time.struct_time(tm_year=2012, tm_mon=2, tm_mday=11, tm_hour=1, tm_min=27, tm_sec=21, tm_wday=5, tm_yday=42, tm_isdst=0)

Any suggestion?

Guobao

Replies:
RE: cothread time stamp problem michael.abbott

Navigate by Date:
Prev: Re: Waveform record missing fields Andrew Johnson
Next: Re: DRVL, DRVH, HOPR, LOPR Dirk Zimoch
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Waveform record missing fields Andrew Johnson
Next: RE: cothread time stamp problem michael.abbott
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024