I know, this is more a database issue, but maybe some TestStand user has dealed with same kind of calculations.
I'd like to make
some system performance & reliability statistics calculations from TestStand generic MySQL recordset based
on time stamps in it; mean time between failure MTBF,
down time DT, etc.
Example:
2007-09-27 12:23:52
2007-09-27 08:50:23
2007-09-26 23:31:34
2007-09-26 21:45:33
Here the times between are (hours:mins): 3:33, 9:18, 1:46 and MTBF=4:52
The following solution is the best I've found so far. Assuming a sequential primary key named ID and a datetime col named dt, one can try:
SELECT SEC_TO_TIME( AVG( TIMESTAMPDIFF( SECOND, t1.dt, t2.dt )))
FROM tbl AS t1
JOIN tbl AS t2 ON t2.id=t1.id+1;
This works, but only if the ID is sequential type. While I'm not allowed to do the database redesign, any ideas I could proceed with this?
Thanks beforehand!