# PDI-2023: P3 Solution ```c= void delay( uint64_t ticks_to_wait ) { uint64_t target_ticks = get_ticks_from_reset() + ticks_to_wait; uint64_t current_ticks; do { current_ticks = get_ticks_from_reset(); } while ( current_ticks < target_ticks ); } void wait_until( uint64_t target_ticks ) { uint64_t current_ticks; do { current_ticks = get_ticks_from_reset(); } while ( current_ticks < target_ticks ); } ``` ```c= int main() { CONSOLE_LOG("----------MONOTONIC TIME---------\n"); InitMonotonicClock(date_time_to_Y2K(14, 9, 22, 12, 40, 0 )); // 14/09/2022 12:40 uint32_t current = 0; do { uint64_t next = get_ticks_from_reset() + (CLINT_CLOCK * 1); current = GetUniversalTime_Y2K(); print_date_time_from_Y2K( current ); // delay( CLINT_CLOCK * 1 ); // delay solution wait_until( next ); } while ( 1 ); } ```