X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Futil%2Ftimefuncs.py;h=f7fbc853735b7743e70cda222018da6a7f6a6ad6;hb=d1c731d0fbf6c0b8a21607795fb1101a46a2518d;hp=3d7c3664e788a0d81ef6aac654f630d799bd53c0;hpb=bac63fdc5983e2ade1902f711c1e7899d82ca4ae;p=nepi.git diff --git a/src/nepi/util/timefuncs.py b/src/nepi/util/timefuncs.py index 3d7c3664..f7fbc853 100644 --- a/src/nepi/util/timefuncs.py +++ b/src/nepi/util/timefuncs.py @@ -113,3 +113,11 @@ def stabsformat(sdate, dbase = None): return None +def compute_delay_ms(timestamp2, timestamp1): + d1 = datetime.datetime.fromtimestamp(float(timestamp1)) + d2 = datetime.datetime.fromtimestamp(float(timestamp2)) + delay = d2 - d1 + + # round up resolution - round up to miliseconds + return delay.total_seconds() * 1000 +