\doxysection{src/core/timer\+\_\+clockgettime.c File Reference}
\label{timer__clockgettime_8c}\index{src/core/timer\_clockgettime.c@{src/core/timer\_clockgettime.c}}


Overriding Time\+: \doxyref{osmo\+\_\+clock\+\_\+gettime()}{p.}{group__timer_gac11a65dfcd1245fa716356d3650d2a6e}  


{\ttfamily \#include \char`\"{}config.\+h\char`\"{}}\newline


\doxysubsection{Detailed Description}
Overriding Time\+: \doxyref{osmo\+\_\+clock\+\_\+gettime()}{p.}{group__timer_gac11a65dfcd1245fa716356d3650d2a6e} 


\begin{DoxyItemize}
\item Useful to write and reproduce tests that depend on specific time factors. This API allows to fake the timespec provided by {\ttfamily clock\+\_\+gettime()} by using a small shim \doxyref{osmo\+\_\+clock\+\_\+gettime()}{p.}{group__timer_gac11a65dfcd1245fa716356d3650d2a6e}.
\item Choose the clock you want to override, for instance CLOCK\+\_\+\+MONOTONIC.
\item If the clock override is disabled (default) for a given clock, \doxyref{osmo\+\_\+clock\+\_\+gettime()}{p.}{group__timer_gac11a65dfcd1245fa716356d3650d2a6e} will do the same as regular {\ttfamily clock\+\_\+gettime()}.
\item If you want \doxyref{osmo\+\_\+clock\+\_\+gettime()}{p.}{group__timer_gac11a65dfcd1245fa716356d3650d2a6e} to provide a specific time, you must enable time override with \doxyref{osmo\+\_\+clock\+\_\+override\+\_\+enable()}{p.}{group__timer_ga3e8cfe4cad482612d1bd8a3df75d2d02}, then set a pointer to the timespec storing the fake time for that specific clock ({\ttfamily struct timespec $\ast$ts = \doxyref{osmo\+\_\+clock\+\_\+override\+\_\+gettimespec()}{p.}{group__timer_ga08c514dddc196eaa1422dbdee8250b70}}) and set it as desired. Next time \doxyref{osmo\+\_\+clock\+\_\+gettime()}{p.}{group__timer_gac11a65dfcd1245fa716356d3650d2a6e} is called, it will return the values previously set through the ts pointer.
\item A helper \doxyref{osmo\+\_\+clock\+\_\+override\+\_\+add()}{p.}{group__timer_ga86a811781179d144f268c0986b7140a9} is provided to increment a given overriden clock with a specific amount of time.
\end{DoxyItemize}