82 p->
secs = (int32_t) d;
84 d -= (double) p->
secs;
106 labs( (
long) nt->
secs ),
116 #if !_IS_MBG_FIRMWARE && !defined( MBG_TGT_MISSING_64_BIT_TYPES ) 135 nt->
secs += additional_secs;
165 double d = (double) p->
secs;
186 p->
secs = (int32_t) d;
188 d -= (double) p->
secs;
206 size_t n =
snprintf_safe( s, max_len,
"%c%" PRId64
".%09" PRId64,
226 #if defined( MBG_TGT_MISSING_LLDIV_T ) 232 lldiv_t lldt = lldiv( p->
secs, div );
241 #if !defined( MBG_TGT_MISSING_STRTOLL ) 258 p->
secs = strtoll( s, &cp, base );
270 int l = (int) ( ep - cp );
272 while ( l < frac_digits )
278 while ( l > frac_digits )
326 #endif // !defined( MBG_TGT_MISSING_STRTOLL ) 343 struct tm tm = { 0 };
349 tm_gps->
year = tm.tm_year + 1900;
350 tm_gps->
month = tm.tm_mon + 1;
351 tm_gps->
mday = tm.tm_mday;
352 tm_gps->
yday = tm.tm_yday;
353 tm_gps->
wday = tm.tm_wday;
354 tm_gps->
hour = tm.tm_hour;
355 tm_gps->
min = tm.tm_min;
356 tm_gps->
sec = tm.tm_sec;
358 #if defined( MBG_TGT_POSIX ) 384 if ( t != (time_t) -1 )
395 #endif // !_IS_MBG_FIRMWARE && !defined( MBG_TGT_MISSING_64_BIT_TYPES ) 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.
#define _nano_time_negative(_nt)
int32_t frac
fractions of a second, 1/RECEIVER_INFO::ticks_per_sec units
A timestamp with nanosecond resolution, but 64 bit size.
Local date and time computed from GPS time.
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.
int8_t sec
seconds, 0..59, or 60 in case of inserted leap second
double nano_time_to_double(const NANO_TIME *p)
Convert a NANO_TIME time to double.
#define mbg_rc_is_success(_rc)
int8_t mday
day of month, 1..31
int16_t year
year number, 0..9999
static __mbg_inline void div_nano_time_64(NANO_TIME_64 *p, long div, long mul)
Generic function to divide NANO_TIME_64 value.
static __mbg_inline void str_to_nano_time_64(const char *s, NANO_TIME_64 *p, int base, int frac_digits)
Generic function to set up a NANO_TIME_64 structure from a string.
void normalize_nano_time_64(NANO_TIME_64 *nt)
Normalize a NANO_TIME_64 time.
static __mbg_inline time_t cvt_to_time_t(mbg_time_t t)
time_t mbg_mktime(int year, int month, int day, int hour, int min, int sec)
Compute a linear time_t value from broken down date and time.
int tm_gps_to_nano_time_64(NANO_TIME_64 *nt, const TM_GPS *tm)
Convert TM_GPS to NANO_TIME_64.
A timestamp with nanosecond resolution.
void double_to_nano_time_64(NANO_TIME_64 *p, double d)
Setup a NANO_TIME_64 structure from a time as double.
size_t snprint_nano_time(char *s, size_t max_len, const NANO_TIME *nt)
Print nano time into string buffer.
int32_t secs
[seconds], usually since 1970-01-01 00:00:00
int32_t offs_from_utc
local time offset from UTC [sec]
int32_t nano_secs
[nanoseconds]
static __mbg_inline int mbg_gmtime(struct tm *p_tm, const time_t *p_time)
int16_t yday
day of year, 1..365, or 366 in case of leap year
void double_to_nano_time(NANO_TIME *p, double d)
Setup a NANO_TIME structure from a time provided as double.
int8_t wday
day of week, 0..6 == Sun..Sat
int snprintf_safe(char *s, size_t max_len, const char *fmt,...)
A portable, safe implementation of snprintf()
int64_t nano_secs
[nanoseconds]
int64_t secs
[seconds], usually since 1970-01-01 00:00:00
unsigned __int64 uint64_t
double nano_time_64_to_double(const NANO_TIME_64 *p)
Convert a NANO_TIME_64 time to double.
int nano_time_64_to_tm_gps(TM_GPS *tm_gps, const NANO_TIME_64 *nt)
Convert NANO_TIME_64 to TM_GPS.
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.