mbgtools-lx
4.2.8
|
#include <gpsdefs.h>
#include <mbgerror.h>
#include <mbgtime.h>
#include <time.h>
#include <stddef.h>
Go to the source code of this file.
Macros | |
#define | _ext extern |
Typedefs | |
typedef int64_t | mbg_time_t |
Functions | |
static __mbg_inline time_t | cvt_to_time_t (mbg_time_t t) |
static __mbg_inline int | mbg_gmtime (struct tm *p_tm, const time_t *p_time) |
static __mbg_inline double | ntp_tstamp_to_double (const NTP_TSTAMP *t) |
static __mbg_inline ulong | ntp_frac_to_nsec (uint32_t frac) |
static __mbg_inline uint32_t | nsec_to_ntp_frac (ulong nsec) |
static __mbg_inline void | timespec_to_ntp_tstamp (NTP_TSTAMP *t_ntp, const struct timespec *t_ts) |
static __mbg_inline void | ntp_tstamp_to_timespec (struct timespec *t_ts, const NTP_TSTAMP *t_ntp) |
static __mbg_inline int | timespec_is_set (const struct timespec *p) |
static __mbg_inline double | delta_timespec_d_s (const struct timespec *ts, const struct timespec *ts_ref) |
static __mbg_inline int64_t | delta_timespec_ll_ns (const struct timespec *ts, const struct timespec *ts_ref) |
int | snprint_gmtime_error (char *s, size_t max_len, int mbg_errno, time_t t, const char *calling_fnc) |
int | mbg_clock_gettime (clockid_t clock_id, struct timespec *tp) |
int | mbg_clock_settime (clockid_t clock_id, const struct timespec *tp) |
void | check_precise_time_api (void) |
int | snprint_utc_offs (char *s, size_t max_len, const char *info, long utc_offs) |
Print a UTC offset into a string. More... | |
int | snprint_time_t_to_iso (time_t tstamp, int offs_hours, char *buf, size_t len) |
int | snprint_time_t_to_iso_ms (time_t tstamp, int offs_hours, time_t frac, char *buf, size_t len) |
int | snprint_time_t_to_iso_us (time_t tstamp, int offs_hours, time_t frac, char *buf, size_t len) |
int | snprint_time_t_to_iso_ns (time_t tstamp, int offs_hours, time_t frac, char *buf, size_t len) |
int | snprint_ntp_tstamp_to_iso_ms (const NTP_TSTAMP *ts, char *buf, size_t len) |
int | snprint_ntp_tstamp_to_iso_us (const NTP_TSTAMP *ts, char *buf, size_t len) |
int | snprint_ntp_tstamp_to_iso_ns (const NTP_TSTAMP *ts, char *buf, size_t len) |
#define _ext extern |
Definition at line 55 of file timeutil.h.
typedef int64_t mbg_time_t |
Definition at line 101 of file timeutil.h.
void check_precise_time_api | ( | void | ) |
Referenced by delta_timespec_ll_ns(), and snprint_gmtime_error().
|
static |
Definition at line 108 of file timeutil.h.
Referenced by mbg_chk_tstamp64_leap_sec(), mbg_snprint_hr_tstamp(), mbg_str_pcps_hr_date(), mbg_str_pcps_hr_date_time_loc(), mbg_str_pcps_hr_date_time_utc(), mbg_str_pcps_hr_time(), nano_time_64_to_tm_gps(), show_utc_info(), snprint_ntp_tstamp_to_iso_ms(), snprint_ntp_tstamp_to_iso_ns(), and snprint_ntp_tstamp_to_iso_us().
|
static |
Definition at line 215 of file timeutil.h.
References NSEC_PER_SEC.
|
static |
Definition at line 228 of file timeutil.h.
References check_precise_time_api(), mbg_clock_gettime(), mbg_clock_settime(), NSEC_PER_SEC, snprint_gmtime_error(), snprint_ntp_tstamp_to_iso_ms(), snprint_ntp_tstamp_to_iso_ns(), snprint_ntp_tstamp_to_iso_us(), snprint_time_t_to_iso(), snprint_time_t_to_iso_ms(), snprint_time_t_to_iso_ns(), snprint_time_t_to_iso_us(), and snprint_utc_offs().
int mbg_clock_gettime | ( | clockid_t | clock_id, |
struct timespec * | tp | ||
) |
Referenced by delta_timespec_ll_ns(), and snprint_gmtime_error().
int mbg_clock_settime | ( | clockid_t | clock_id, |
const struct timespec * | tp | ||
) |
Referenced by delta_timespec_ll_ns(), and snprint_gmtime_error().
|
static |
Definition at line 118 of file timeutil.h.
References mbg_get_last_error(), and MBG_SUCCESS.
Referenced by do_str_pcps_hr_date_time(), mbg_chk_tstamp64_leap_sec(), mbg_snprint_hr_tstamp(), mbg_str_pcps_hr_date(), mbg_str_pcps_hr_time(), nano_time_64_to_tm_gps(), set_system_time_from_pcps_time(), show_utc_info(), sn_printf_timespec(), and snprint_time_t_to_iso().
|
static |
Definition at line 162 of file timeutil.h.
References NSEC_PER_SEC, and NTP_FRAC_PER_SEC.
Referenced by timespec_to_ntp_tstamp().
|
static |
Definition at line 145 of file timeutil.h.
References NSEC_PER_SEC, and NTP_FRAC_PER_SEC.
Referenced by ntp_tstamp_to_timespec().
|
static |
Definition at line 136 of file timeutil.h.
References NTP_TSTAMP::fractions, NTP_FRAC_PER_SEC, and NTP_TSTAMP::seconds.
|
static |
Definition at line 191 of file timeutil.h.
References NTP_TSTAMP::fractions, ntp_frac_to_nsec(), NTP_SEC_BIAS, and NTP_TSTAMP::seconds.
int snprint_gmtime_error | ( | char * | s, |
size_t | max_len, | ||
int | mbg_errno, | ||
time_t | t, | ||
const char * | calling_fnc | ||
) |
Definition at line 55 of file timeutil.c.
References _int_from_size_t, check_precise_time_api(), FILETIME, HNS_PER_SEC, mbg_clock_gettime(), mbg_clock_settime(), mbg_strerror(), NSEC_PER_SEC, and snprintf_safe().
Referenced by delta_timespec_ll_ns(), mbg_snprint_hr_tstamp(), and show_utc_info().
int snprint_ntp_tstamp_to_iso_ms | ( | const NTP_TSTAMP * | ts, |
char * | buf, | ||
size_t | len | ||
) |
Definition at line 322 of file timeutil.c.
References bin_frac_32_to_msec, cvt_to_time_t(), NTP_TSTAMP::fractions, NTP_SEC_BIAS, NTP_TSTAMP::seconds, and snprint_time_t_to_iso_ms().
Referenced by delta_timespec_ll_ns().
int snprint_ntp_tstamp_to_iso_ns | ( | const NTP_TSTAMP * | ts, |
char * | buf, | ||
size_t | len | ||
) |
Definition at line 346 of file timeutil.c.
References bin_frac_32_to_nsec, cvt_to_time_t(), NTP_TSTAMP::fractions, NTP_SEC_BIAS, NTP_TSTAMP::seconds, and snprint_time_t_to_iso_ns().
Referenced by delta_timespec_ll_ns().
int snprint_ntp_tstamp_to_iso_us | ( | const NTP_TSTAMP * | ts, |
char * | buf, | ||
size_t | len | ||
) |
Definition at line 334 of file timeutil.c.
References bin_frac_32_to_usec, cvt_to_time_t(), NTP_TSTAMP::fractions, NTP_SEC_BIAS, NTP_TSTAMP::seconds, and snprint_time_t_to_iso_us().
Referenced by delta_timespec_ll_ns().
int snprint_time_t_to_iso | ( | time_t | tstamp, |
int | offs_hours, | ||
char * | buf, | ||
size_t | len | ||
) |
Definition at line 243 of file timeutil.c.
References _int_from_size_t, mbg_gmtime(), mbg_rc_is_error, SECS_PER_HOUR, and snprintf_safe().
Referenced by __to_iso_frac(), and delta_timespec_ll_ns().
int snprint_time_t_to_iso_ms | ( | time_t | tstamp, |
int | offs_hours, | ||
time_t | frac, | ||
char * | buf, | ||
size_t | len | ||
) |
Definition at line 283 of file timeutil.c.
References __to_iso_frac(), and MSEC_PER_SEC.
Referenced by delta_timespec_ll_ns(), and snprint_ntp_tstamp_to_iso_ms().
int snprint_time_t_to_iso_ns | ( | time_t | tstamp, |
int | offs_hours, | ||
time_t | frac, | ||
char * | buf, | ||
size_t | len | ||
) |
Definition at line 309 of file timeutil.c.
References __to_iso_frac(), and NSEC_PER_SEC.
Referenced by delta_timespec_ll_ns(), and snprint_ntp_tstamp_to_iso_ns().
int snprint_time_t_to_iso_us | ( | time_t | tstamp, |
int | offs_hours, | ||
time_t | frac, | ||
char * | buf, | ||
size_t | len | ||
) |
Definition at line 296 of file timeutil.c.
References __to_iso_frac(), and USEC_PER_SEC.
Referenced by delta_timespec_ll_ns(), and snprint_ntp_tstamp_to_iso_us().
int snprint_utc_offs | ( | char * | s, |
size_t | max_len, | ||
const char * | info, | ||
long | utc_offs | ||
) |
Print a UTC offset into a string.
Format of the string is "[info]+hh[:mm[:ss]]h"
[out] | s | Address of a string buffer to be filled. |
[in] | max_len | Size of the string buffer. |
[in] | info | An optional info string to be prepended, may be NULL. |
[in] | utc_offs | The UTC offset to be printed, in [s]. |
Definition at line 211 of file timeutil.c.
References _int_from_size_t, MINS_PER_HOUR, SECS_PER_HOUR, sn_cpy_str_safe(), and snprintf_safe().
Referenced by delta_timespec_ll_ns(), get_tz_name(), mbg_snprint_hr_time(), and show_time_and_status().
|
static |
Definition at line 203 of file timeutil.h.
|
static |
Definition at line 181 of file timeutil.h.
References NTP_TSTAMP::fractions, nsec_to_ntp_frac(), NTP_SEC_BIAS, and NTP_TSTAMP::seconds.