moved time check to own function, now check before executing command