In the duration calculation, only the "nanosec" part of "current time" was used and "sec" part was ignored. On the other hand both "nanosec" and "sec" part of "last time" were used correctly.
Therefore, duration became a negative value with a large absolute value, and as a result, the twist had a small absolute value with the opposite sign.
This fixes #977 .
Problem
In the duration calculation, only the "nanosec" part of "current time" was used and "sec" part was ignored. On the other hand both "nanosec" and "sec" part of "last time" were used correctly.
Therefore, duration became a negative value with a large absolute value, and as a result, the twist had a small absolute value with the opposite sign.
Solution
Fixed calculation of duration to be correct.