X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=lttv%2Flttv%2Fsync%2Fdata_structures.c;h=d4c804b68523c20f7778ea4a6ae25060b8c0a3a5;hb=76be6fc24daf61767bf7f0c2e64f4691fbb56c63;hp=70eb22c74a84f6d56f957f2d81da5f4d4422072e;hpb=2bd4b3e43e525da7b4c9738915ec847f7fe4906a;p=lttv.git diff --git a/lttv/lttv/sync/data_structures.c b/lttv/lttv/sync/data_structures.c index 70eb22c7..d4c804b6 100644 --- a/lttv/lttv/sync/data_structures.c +++ b/lttv/lttv/sync/data_structures.c @@ -563,3 +563,18 @@ void gfDestroyEvent(gpointer data, gpointer user_data) event->destroy(event); } + + +/* Subtract two WallTime structs + * + * Args: + * tA, tB: WallTime + * + * Returns: + * The result of tA - tB, as a double. This may incur a loss of + * precision. + */ +double wallTimeSub(const WallTime const* tA, const WallTime const* tB) +{ + return tA->seconds - tB->seconds + (tA->nanosec - tB->nanosec) / 1e9; +}