Commit b193a4f9 authored by Federico Vaga's avatar Federico Vaga

py: implement __float__ for FmcTdcTime

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent a17498f6
......@@ -22,10 +22,14 @@ class FmcTdcTime(ctypes.Structure):
]
def __str__(self):
return "seq: {:d} timestamp: {:f} raw: {:08x}:{:08x}:{:08x}, debug: {:08x}".format(self.seq_id, float(self), self.seconds, self.coarse, self.frac, self.debug)
def __float__(self):
ts = self.seconds
ts = ts + (self.coarse / 1000000000.0 * 8)
ts = ts + ((self.frac * 7.999) / 4095) / 1000000000
return "seq: {:d} timestamp: {:f} raw: {:08x}:{:08x}:{:08x}, debug: {:08x}".format(self.seq_id, ts, self.seconds, self.coarse, self.frac, self.debug)
return ts
def libfmctdc_create():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment