Rounding time to nearest

When I want to do the following check:


if ($realtime == 1us)
...

where $realtime gives the value 1.000000005us, this if statement fails because obviously, at the fs level, these two are technically not equal.

Is there a way to multiply/some other operation to the $realtime to force it to round down to the nearest microsecond?

Thanks!

In reply to ce_2015:

This a general problem with real numbers and equality. You should try to put your expression in terms of of a relational operator, or cast your expression to an int.

int’($realtime/1us) == 1

In reply to dave_59:

I knew Dave would have the answer!

Thank you!