Alternatives for CLOCK_MONOTONIC

Hi,

I need to develop timeout functionality in my code, which is not affected by system's time changes.Unfortunately I dont have CLOCK_MONOTONIC support in my OS.

Are there any alternatives?

What options does clock_gettime() support for your system?

it supports only CLOCK_REALTIME :frowning:
though CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID are defined too in bits/time.h, but clock_gettime() gives an error "Invalid argument" for these...

------from bits/time.h-----
/* Identifier for system-wide realtime clock. /
# define CLOCK_REALTIME 0
/
High-resolution timer from the CPU. /
# define CLOCK_PROCESS_CPUTIME_ID 2
/
Thread-specific CPU-time clock. */
# define CLOCK_THREAD_CPUTIME_ID 3
-----------------------------

Just use setitimer()/getitimer().