from time import sleep, time from time_recoder.save_recorded_time_in_table import save_recorded_time_in_table from time_recoder.time_recoder_config import TEST_CASE def get_current_time_as_timestamp(): return int(time()) def stop_record_time(): if TEST_CASE: sleep(5) return True else: NotImplementedError def time_recording_main(): start_time = get_current_time_as_timestamp() while not stop_record_time(): sleep(1) else: worked_time_in_minutes = (get_current_time_as_timestamp() - start_time)/60 save_recorded_time_in_table(worked_time_in_minutes) if __name__ == '__main__': time_recording_main()