Skip to content

Fix timestamp on read error

Miquel Navarro requested to merge fix-error-timestamp into develop

Fixed the timestamp of attributes when the read raises an exception. We were using the timestamp of the read start and not it's the timestamp of the moment when the error raised.
This new behavior is consistent with Tango. When a slow attribute is read, the timestamp you get is the moment when it finished reading, not when it started.
This code snippet allows you to check it:

import tango
import time
dp = tango.DeviceProxy("test/tpo/1")
print("Start: ", time.time())
try:
    read = dp.read_attribute("slow_attr_1")
except Exception as e:
    print(e)


print("Read time:", read.time.totime())
print("Current time:", time.time())

So now, in case of exceptions (including timeout), the error timestamp will be the moment when it failed.

Merge request reports