Update time and index functions

Added functions to update the current time and index number, and logic
check the index against the current time