logging: add log_output_timestamp_to_us() helper function
So far we only have log_msg_timestamp_get() function, which returns internal timestamp representation. This is either clock cycles or uptime in ms, depending on main clock precision. Introduce log_output_timestamp_to_us() helper function, which allows to convert internal logging timestamp to us. Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
This commit is contained in:
parent
de16299c62
commit
552028dd20
2 changed files with 15 additions and 0 deletions
|
@ -753,3 +753,10 @@ void log_output_timestamp_freq_set(uint32_t frequency)
|
|||
|
||||
freq = frequency;
|
||||
}
|
||||
|
||||
uint64_t log_output_timestamp_to_us(uint32_t timestamp)
|
||||
{
|
||||
timestamp /= timestamp_div;
|
||||
|
||||
return ((uint64_t) timestamp * 1000000U) / freq;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue