1) Fixed all incorrect ticks-->ms and ms-->ticks conversions
2) Replaced conversions by macro. Strict usage of this macro
will prevent errors of this type.