Back to ITRS Internal Only FAQ

Internal documentation only

This page has been marked as draft.

Rules - Calculate millisecond difference between 2 cells

Context:

The client created the rule to calculate the difference between 2 timestamps, it works fine but it is only able to get the difference in seconds, the client is hoping to get in it milliseconds considering that both values include milliseconds and happen in the same second.

Workaround:

One way is to treat the timestamp as 2 numbers. One whole number plus the decimals. Below is an example of how first extract the whole number and then extract the millisecond value. It takes 2 steps for the millsecond value as after the dot it included the year.

set $(a) path "a" value
set $(av) parseDate("%a %b %d %H:%M:%S%f %Y", $(a))
set $(mili\_av\_withYear) stringAfter($(a), ".")
set $(mili\_av) stringBefore($(mili\_av\_withYear), " ") / 1000
set $(a\_mili) $(av) + $(mili\_av)

set $(b) path "b" value
set $(bv) parseDate("%a %b %d %H:%M:%S%f %Y", $(b))
set $(mili\_bv\_withYear) stringAfter($(b), ".")
set $(mili\_bv) stringBefore($(mili\_bv\_withYear), " ") / 1000
set $(b\_mili) $(bv) + $(mili\_bv)

value $(b\_mili) - $(a\_mili)
["Geneos"] ["FAQ"]

Was this topic helpful?