$time vs $realtime

In reply to dave_59:

Hi Dave, Thanks for the explanation, but I got one more doubt. If I go by what you just said:

In case of $realtime, in simulation log, look at the Time = 32, don’t you think it should be Time = 31.

Method 1 : Adding time first, and then convert
#1.55 a= 0;
#1.55 a = 1; // 1.55 + 1.55 = 3.1, Now 3.1 * 10 should be 31.

Method 2 : If I first convert them, and then add:
#1.55 a = 0; // 1.6 → 16
#1.55 a = 1; // 1.6 → 16
Now, total time is 32. Which is correct in $realtime case and as shown in Simulation log.

But, now let me apply the method 1 in case of $time
#1.55 a = 0;
#1.55 a = 1; // 1.55 + 1.55 = 3.1 → 3.0 → 30 which is shown correct in simulation

Now, let’s take method 2 in case of $time
#1.55 a = 0; // 1.6 → 20
#1.55 a = 1; // 1.6 → 20
Now, total time is 40.

You see, for $realtime method 2 is correct in simulation log, whereas for $time method 1 is showing correct simulation. But I don’t think simulator will follow different algorithm for these two cases.

Please put some light on the above doubt.

Thanks,

Mukul