refactoring
fixed and improved accuracy of time calculation