refactored parseTime function outside the server