Include dependency graph for mtime.c:

Data Structures | |
| struct | timespec |
Defines | |
| #define | _POSIX_CLOCK_SELECTION (-1) |
| #define | CLOCK_MONOTONIC CLOCK_REALTIME |
Functions | |
| char * | mstrtime (char *psz_buffer, mtime_t date) |
| Return a date in a readable format. | |
| char * | secstotimestr (char *psz_buffer, int i_seconds) |
| Convert seconds to a time in the format h:mm:ss. | |
| static unsigned | mprec (void) |
| Return a value that is no bigger than the clock precision (possibly zero). | |
| mtime_t | mdate (void) |
| Return high precision date. | |
| void | mwait (mtime_t date) |
| Wait for a date. | |
| void | msleep (mtime_t delay) |
| More precise sleep(). | |
| void | date_Init (date_t *p_date, uint32_t i_divider_n, uint32_t i_divider_d) |
| Initialize a date_t. | |
| void | date_Change (date_t *p_date, uint32_t i_divider_n, uint32_t i_divider_d) |
| Change a date_t. | |
| void | date_Set (date_t *p_date, mtime_t i_new_date) |
| Set the date value of a date_t. | |
| mtime_t | date_Get (const date_t *p_date) |
| Get the date of a date_t. | |
| void | date_Move (date_t *p_date, mtime_t i_difference) |
| Move forwards or backwards the date of a date_t. | |
| mtime_t | date_Increment (date_t *p_date, uint32_t i_nb_samples) |
| Increment the date and return the result, taking into account rounding errors. | |
| uint64_t | NTPtime64 (void) |
| |
| #define _POSIX_CLOCK_SELECTION (-1) |
| #define CLOCK_MONOTONIC CLOCK_REALTIME |
| void date_Change | ( | date_t * | p_date, | |
| uint32_t | i_divider_n, | |||
| uint32_t | i_divider_d | |||
| ) |
Change a date_t.
| date | to change | |
| divider | (sample rate) numerator | |
| divider | (sample rate) denominator |
Increment the date and return the result, taking into account rounding errors.
| date | to increment | |
| incrementation | in number of samples |
| void date_Init | ( | date_t * | p_date, | |
| uint32_t | i_divider_n, | |||
| uint32_t | i_divider_d | |||
| ) |
Initialize a date_t.
| date | to initialize | |
| divider | (sample rate) numerator | |
| divider | (sample rate) denominator |
| mtime_t mdate | ( | void | ) |
Return high precision date.
Use a 1 MHz clock when possible, or 1 kHz
Beware ! It doesn't reflect the actual date (since epoch), but can be the machine's uptime or anything (when monotonic clock is used)
| static unsigned mprec | ( | void | ) | [inline, static] |
Return a value that is no bigger than the clock precision (possibly zero).
| void msleep | ( | mtime_t | delay | ) |
More precise sleep().
Portable usleep() function.
| delay | the amount of time to sleep |
| char* mstrtime | ( | char * | psz_buffer, | |
| mtime_t | date | |||
| ) |
Return a date in a readable format.
This function converts a mtime date into a string. psz_buffer should be a buffer long enough to store the formatted date.
| date | to be converted | |
| psz_buffer | should be a buffer at least MSTRTIME_MAX_SIZE characters |
| void mwait | ( | mtime_t | date | ) |
Wait for a date.
This function uses select() and an system date function to wake up at a precise date. It should be used for process synchronization. If current date is posterior to wished date, the function returns immediately.
| date | The date to wake up at |
| uint64_t NTPtime64 | ( | void | ) |
| char* secstotimestr | ( | char * | psz_buffer, | |
| int | i_seconds | |||
| ) |
Convert seconds to a time in the format h:mm:ss.
This function is provided for any interface function which need to print a time string in the format h:mm:ss date.
| secs | the date to be converted | |
| psz_buffer | should be a buffer at least MSTRTIME_MAX_SIZE characters |
1.5.1