The POSIX people thought about this, and the solution they came up with was another clock source called CLOCK_MONOTONIC.
When you create a timer object with timer_create(), you can tell it which clock source to use.
The way CLOCK_MONOTONIC works is that its timebase is never adjusted. The impact of that is that regardless of what time it is in the real world, if you base a timer on CLOCK_MONOTONIC and add 30 seconds to it (and then do whatever adjustments you want to the time), the timer will expire in 30 elapsed seconds.
The clock source CLOCK_MONOTONIC has the following characteristics:
Functions that don't let you choose the clock source—such as pthread_mutex_timedlock()—use CLOCK_REALTIME. This is built in to the function and isn't something that you can change.