mbgtools-lx
4.2.8
|
Go to the source code of this file.
Macros | |
#define | _ext extern |
Functions | |
double | nano_time_to_double (const NANO_TIME *p) |
Convert a NANO_TIME time to double. More... | |
void | double_to_nano_time (NANO_TIME *p, double d) |
Setup a NANO_TIME structure from a time provided as double. More... | |
size_t | snprint_nano_time (char *s, size_t max_len, const NANO_TIME *nt) |
Print nano time into string buffer. More... | |
void | normalize_nano_time_64 (NANO_TIME_64 *nt) |
Normalize a NANO_TIME_64 time. More... | |
double | nano_time_64_to_double (const NANO_TIME_64 *p) |
Convert a NANO_TIME_64 time to double. More... | |
void | double_to_nano_time_64 (NANO_TIME_64 *p, double d) |
Setup a NANO_TIME_64 structure from a time as double. More... | |
size_t | snprint_nano_time_64 (char *s, size_t max_len, const NANO_TIME_64 *nt) |
Print a normalized NANO_TIME_64 into a string buffer. More... | |
void | str_s_to_nano_time_64 (const char *s, NANO_TIME_64 *p) |
Set up a NANO_TIME_64 structure from a string with a time in seconds and fractions. More... | |
void | str_ms_to_nano_time_64 (const char *s, NANO_TIME_64 *p) |
Set up a NANO_TIME_64 structure from a string with a time in milliseconds and fractions. More... | |
int | nano_time_64_to_tm_gps (TM_GPS *tm_gps, const NANO_TIME_64 *nt) |
Convert NANO_TIME_64 to TM_GPS. More... | |
int | tm_gps_to_nano_time_64 (NANO_TIME_64 *nt, const TM_GPS *tm) |
Convert TM_GPS to NANO_TIME_64. More... | |
#define _ext extern |
Definition at line 38 of file nanotime.h.
void double_to_nano_time | ( | NANO_TIME * | p, |
double | d | ||
) |
Setup a NANO_TIME structure from a time provided as double.
[out] | p | Address of a NANO_TIME structure to be set up |
[in] | d | The time to be converted, in seconds with fractions, as double |
Definition at line 80 of file nanotime.c.
References NANO_TIME::nano_secs, and NANO_TIME::secs.
void double_to_nano_time_64 | ( | NANO_TIME_64 * | p, |
double | d | ||
) |
Setup a NANO_TIME_64 structure from a time as double.
[out] | p | Address of a NANO_TIME_64 structure to be set up |
[in] | d | The time to be converted, in seconds with fractions, as double |
Definition at line 184 of file nanotime.c.
References NANO_TIME_64::nano_secs, and NANO_TIME_64::secs.
double nano_time_64_to_double | ( | const NANO_TIME_64 * | p | ) |
Convert a NANO_TIME_64 time to double.
[in] | p | Address of a NANO_TIME_64 structure to be converted |
Definition at line 163 of file nanotime.c.
References NANO_TIME_64::nano_secs, and NANO_TIME_64::secs.
int nano_time_64_to_tm_gps | ( | TM_GPS * | tm_gps, |
const NANO_TIME_64 * | nt | ||
) |
Convert NANO_TIME_64 to TM_GPS.
[out] | tm_gps | The TM_GPS to be filled |
[in] | nt | The NANO_TIME_64 to be converted |
Definition at line 341 of file nanotime.c.
References cvt_to_time_t(), TM_GPS::frac, TM_GPS::hour, mbg_gmtime(), mbg_rc_is_success, TM_GPS::mday, TM_GPS::min, TM_GPS::month, TM_GPS::offs_from_utc, TM_GPS::sec, NANO_TIME_64::secs, TM_GPS::wday, TM_GPS::yday, and TM_GPS::year.
double nano_time_to_double | ( | const NANO_TIME * | p | ) |
Convert a NANO_TIME time to double.
[in] | p | Address of a NANO_TIME structure to be converted |
Definition at line 59 of file nanotime.c.
References NANO_TIME::nano_secs, and NANO_TIME::secs.
void normalize_nano_time_64 | ( | NANO_TIME_64 * | nt | ) |
Normalize a NANO_TIME_64 time.
After normalization, the following can be assumed:
[in,out] | nt | The NANO_TIME_64 to be normalized |
Definition at line 128 of file nanotime.c.
References NANO_TIME_64::nano_secs, NSEC_PER_SEC, and NANO_TIME_64::secs.
size_t snprint_nano_time | ( | char * | s, |
size_t | max_len, | ||
const NANO_TIME * | nt | ||
) |
Print nano time into string buffer.
[out] | s | The string buffer to be filled |
[in] | max_len | Size of the output buffer for 0-terminated string |
[in] | nt | The NANO_TIME to be printed |
Definition at line 102 of file nanotime.c.
References _nano_time_negative, NANO_TIME::nano_secs, NANO_TIME::secs, and snprintf_safe().
Referenced by show_ptp_state().
size_t snprint_nano_time_64 | ( | char * | s, |
size_t | max_len, | ||
const NANO_TIME_64 * | nt | ||
) |
Print a normalized NANO_TIME_64 into a string buffer.
[out] | s | The string buffer to be filled |
[in] | max_len | Size of the output buffer for 0-terminated string |
[in] | nt | The NANO_TIME_64 to be printed |
Definition at line 204 of file nanotime.c.
References _abs64, _nano_time_negative, NANO_TIME_64::nano_secs, NANO_TIME_64::secs, and snprintf_safe().
void str_ms_to_nano_time_64 | ( | const char * | s, |
NANO_TIME_64 * | p | ||
) |
Set up a NANO_TIME_64 structure from a string with a time in milliseconds and fractions.
[in] | s | A string with a time in milliseconds, with fractions separated by decimal point |
[out] | p | Address of a NANO_TIME_64 structure to be set up |
Definition at line 315 of file nanotime.c.
References div_nano_time_64(), and str_s_to_nano_time_64().
void str_s_to_nano_time_64 | ( | const char * | s, |
NANO_TIME_64 * | p | ||
) |
Set up a NANO_TIME_64 structure from a string with a time in seconds and fractions.
[in] | s | A string with a time in seconds, with fractions separated by decimal point |
[out] | p | Address of a NANO_TIME_64 structure to be set up |
Definition at line 300 of file nanotime.c.
References str_to_nano_time_64().
Referenced by str_ms_to_nano_time_64().
int tm_gps_to_nano_time_64 | ( | NANO_TIME_64 * | nt, |
const TM_GPS * | tm | ||
) |
Convert TM_GPS to NANO_TIME_64.
[out] | nt | The NANO_TIME_64 to be filled |
[in] | tm | The TM_GPS to be converted |
Definition at line 380 of file nanotime.c.
References TM_GPS::hour, mbg_mktime(), TM_GPS::mday, TM_GPS::min, TM_GPS::month, NANO_TIME_64::nano_secs, TM_GPS::sec, NANO_TIME_64::secs, and TM_GPS::year.