optimised convertTimeToMilliseconds to be a bit faster