mbgtools-lx  4.2.8
mbgutil.h File Reference
#include <mbg_tgt.h>
#include <timeutil.h>
#include <use_pack.h>
#include <pcpsdefs.h>
#include <mbggeo.h>
#include <pci_asic.h>
#include <stdlib.h>

Go to the source code of this file.

Macros

#define MBGUTIL_VERSION   0x0308
 
#define MBGUTIL_COMPAT_VERSION   0x0110
 
#define _ext   extern
 
#define _mbg_strncpy(_s, _src)   mbg_strncpy( _s, sizeof( _s ), _src )
 

Functions

int mbgutil_get_version (void)
 Get the version number of the precompiled DLL/shared object library. More...
 
int mbgutil_check_version (int header_version)
 Check if the DLL/shared library is compatible with a given version. More...
 
int mbg_snprintf (char *s, size_t max_len, const char *fmt,...)
 A portable, safe implementation of snprintf() More...
 
int mbg_strncpy (char *s, size_t max_len, const char *src)
 A portable, safe implementation of strncpy() More...
 
int mbg_strchar (char *s, size_t max_len, char c, size_t n)
 Write a character multiple times to a string buffer. More...
 
int mbg_str_date_short (char *s, int max_len, int mday, int month)
 Write a short date string "dd.mm." to a string buffer. More...
 
int mbg_str_date (char *s, int max_len, int mday, int month, int year)
 Write a date string "dd.mm.yyyy" to a string buffer. More...
 
int mbg_str_time_short (char *s, int max_len, int hour, int min)
 Write a short time string "hh:mm" to a string buffer. More...
 
int mbg_str_time (char *s, int max_len, int hour, int min, int sec)
 Write a time string "hh:mm:ss" to a string buffer. More...
 
int mbg_str_time_long (char *s, int max_len, int hour, int min, int sec, int sec100)
 Write a long time string "hh:mm:ss.cc" to a string buffer. More...
 
int mbg_str_tm_gps_date_time (char *s, int max_len, const TM_GPS *pt)
 Write a full date and time string to a string buffer. More...
 
int mbg_str_pcps_date_short (char *s, int max_len, const PCPS_TIME *pt)
 Write the short date given as PCPS_TIME structure to a string buffer. More...
 
int mbg_str_pcps_date (char *s, int max_len, const PCPS_TIME *pt)
 Write the date given as PCPS_TIME structure to a string buffer. More...
 
int mbg_str_pcps_time_short (char *s, int max_len, const PCPS_TIME *pt)
 Write the short time given as PCPS_TIME structure to a string buffer. More...
 
int mbg_str_pcps_time (char *s, int max_len, const PCPS_TIME *pt)
 Write the time given as PCPS_TIME structure to a string buffer. More...
 
int mbg_str_pcps_time_long (char *s, int max_len, const PCPS_TIME *pt)
 Write the time including sec100ths given as PCPS_TIME structure to a string buffer. More...
 
int mbg_str_pcps_date_time (char *s, int max_len, const PCPS_TIME *pt, const char *tz_str)
 Write date and time given as PCPS_TIME structure to a string buffer. More...
 
int mbg_str_pcps_hr_date (char *s, int max_len, uint32_t sec)
 Write date derived from seconds-since-epoch to a string buffer. More...
 
int mbg_str_pcps_hr_time (char *s, int max_len, uint32_t sec)
 Write time derived from seconds-since-epoch to a string buffer. More...
 
int mbg_str_pcps_hr_date_time_utc (char *s, int max_len, const PCPS_HR_TIME *pt)
 Write UTC date and time given as PCPS_HR_TIME structure to a string buffer. More...
 
int mbg_str_pcps_hr_date_time_loc (char *s, int max_len, const PCPS_HR_TIME *pt)
 Write local date and time given as PCPS_HR_TIME structure to a string buffer. More...
 
int mbg_str_pcps_hr_time_frac (char *s, int max_len, uint32_t frac)
 Print binary PCPS_FRAC_32 fractions in decimal to a string buffer. More...
 
int mbg_str_pcps_hr_time_offs (char *s, int max_len, const PCPS_HR_TIME *pt, const char *info)
 Print the UTC offset from a PCPS_HR_TIME structure to a string buffer. More...
 
int mbg_str_pcps_hr_tstamp_utc (char *s, int max_len, const PCPS_HR_TIME *pt)
 Write a high resolution UTC time stamp including fractions to a string buffer. More...
 
int mbg_str_pcps_hr_tstamp_loc (char *s, int max_len, const PCPS_HR_TIME *pt)
 Write a high resolution local time stamp including fractions to a string buffer. More...
 
int mbg_str_pcps_tstamp_raw (char *s, int max_len, const PCPS_TIME_STAMP *pt)
 Write a raw high resolution time stamp to a string buffer. More...
 
int mbg_str_pcps_hr_time_raw (char *s, int max_len, const PCPS_HR_TIME *pt)
 Write a raw high resolution time stamp plus converted local time to a string buffer. More...
 
int mbg_str_ucap (char *s, int max_len, const PCPS_HR_TIME *pt)
 Write time capture / user capture time stamp to a string buffer. More...
 
int mbg_str_pos_dms (char *s, int max_len, const DMS *pdms, int prec)
 Write a geographic coordinate in degrees - minutes - seconds to a string buffer. More...
 
int mbg_str_pos_alt (char *s, int max_len, double alt)
 Write a position's altitude parameter to a string buffer. More...
 
int mbg_str_pos (char *s, int max_len, const POS *ppos, int prec)
 Write geographic coordinates to a string buffer. More...
 
int mbg_str_dev_name (char *s, int max_len, const char *short_name, uint16_t fw_rev_num, PCI_ASIC_VERSION asic_ver_num)
 Write device info to a string buffer. More...
 

Macro Definition Documentation

◆ _ext

#define _ext   extern

Definition at line 105 of file mbgutil.h.

◆ _mbg_strncpy

#define _mbg_strncpy (   _s,
  _src 
)    mbg_strncpy( _s, sizeof( _s ), _src )

Definition at line 124 of file mbgutil.h.

◆ MBGUTIL_COMPAT_VERSION

#define MBGUTIL_COMPAT_VERSION   0x0110

Definition at line 80 of file mbgutil.h.

Referenced by mbgutil_check_version().

◆ MBGUTIL_VERSION

#define MBGUTIL_VERSION   0x0308

Definition at line 78 of file mbgutil.h.

Referenced by mbgutil_get_version().

Function Documentation

◆ mbg_snprintf()

int mbg_snprintf ( char *  s,
size_t  max_len,
const char *  fmt,
  ... 
)

A portable, safe implementation of snprintf()

The output string buffer is in any case properly terminated by 0. For a detailed description see vsnprintf_safe

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]fmtFormat string according to subsequent parameters
[in]...Variable argument list according to the format string
Returns
the number of characters written to the output buffer, except the terminating 0
See also
vsnprintf_safe
snprintf_safe

A portable, safe implementation of snprintf()

The output string buffer is in any case properly terminated by 0. For a detailed description see vsnprintf_safe.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]fmtFormat string according to subsequent parameters
[in]...Variable argument list according to the format string
Returns
the number of characters written to the output buffer, except the terminating 0
See also
vsnprintf_safe
snprintf_safe

Definition at line 157 of file mbgutil.c.

References vsnprintf_safe().

Referenced by mbg_snprint_hr_time_loc(), show_ext_stat_info(), show_utc_info(), snprint_hours_mins(), and str_raw_irig_utc_offs_hours().

◆ mbg_str_date()

int mbg_str_date ( char *  s,
int  max_len,
int  mday,
int  month,
int  year 
)

Write a date string "dd.mm.yyyy" to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]mdayDay-of-month number, 1..31
[in]monthMonth number, 1..12
[in]yearYear number
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 268 of file mbgutil.c.

References mbg_str_date_short(), mbg_year_lim, pcps_exp_year(), and snprintf_safe().

Referenced by do_str_pcps_hr_date_time(), mbg_str_pcps_date(), mbg_str_pcps_hr_date(), and mbg_str_tm_gps_date_time().

◆ mbg_str_date_short()

int mbg_str_date_short ( char *  s,
int  max_len,
int  mday,
int  month 
)

Write a short date string "dd.mm." to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]mdayDay-of-month number, 1..31
[in]monthMonth number, 1..12
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 243 of file mbgutil.c.

References snprintf_safe().

Referenced by mbg_str_date(), and mbg_str_pcps_date_short().

◆ mbg_str_dev_name()

int mbg_str_dev_name ( char *  s,
int  max_len,
const char *  short_name,
uint16_t  fw_rev_num,
PCI_ASIC_VERSION  asic_ver_num 
)

Write device info to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]short_nameShort device name, e.g. in MBG_DEV_NAME format
[in]fw_rev_numThe firmware revision number
[in]asic_ver_numThe ASIC version number
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 963 of file mbgutil.c.

References _convert_asic_version_number, _int_from_size_t, _pcps_asic_version_major, _pcps_asic_version_minor, _pcps_fw_rev_num_major, _pcps_fw_rev_num_minor, dev_name, device_id_is_serial(), MBG_GRP_SERNUM_LEN, PCPS_ASIC_STR_FMT, PCPS_FW_STR_FMT, sn_cpy_str_safe(), snprintf_safe(), and strncpy_safe().

◆ mbg_str_pcps_date()

int mbg_str_pcps_date ( char *  s,
int  max_len,
const PCPS_TIME pt 
)

Write the date given as PCPS_TIME structure to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]ptPointer to a PCPS_TIME structure providing date and time
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 421 of file mbgutil.c.

References mbg_str_date(), PCPS_TIME::mday, PCPS_TIME::month, and PCPS_TIME::year.

Referenced by mbg_str_pcps_date_time().

◆ mbg_str_pcps_date_short()

int mbg_str_pcps_date_short ( char *  s,
int  max_len,
const PCPS_TIME pt 
)

Write the short date given as PCPS_TIME structure to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]ptPointer to a PCPS_TIME structure providing date and time
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 400 of file mbgutil.c.

References mbg_str_date_short(), PCPS_TIME::mday, and PCPS_TIME::month.

◆ mbg_str_pcps_date_time()

int mbg_str_pcps_date_time ( char *  s,
int  max_len,
const PCPS_TIME pt,
const char *  tz_str 
)

Write date and time given as PCPS_TIME structure to a string buffer.

The number of space characters between date and time is determined by the global variable mbg_date_time_dist.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]ptPointer to a PCPS_TIME structure providing date and time
[in]tz_strOptional time zone string to be appended, currently not used, may be NULL
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 509 of file mbgutil.c.

References mbg_date_time_dist, mbg_str_pcps_date(), mbg_str_pcps_time(), and mbg_strchar().

◆ mbg_str_pcps_hr_date()

int mbg_str_pcps_hr_date ( char *  s,
int  max_len,
uint32_t  sec 
)

Write date derived from seconds-since-epoch to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]secNumber of seconds since the epoch to be converted to date and time
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 536 of file mbgutil.c.

References cvt_to_time_t(), mbg_gmtime(), mbg_rc_is_success, mbg_str_date(), sn_cpy_str_safe(), and str_inv_cnv.

◆ mbg_str_pcps_hr_date_time_loc()

int mbg_str_pcps_hr_date_time_loc ( char *  s,
int  max_len,
const PCPS_HR_TIME pt 
)

Write local date and time given as PCPS_HR_TIME structure to a string buffer.

The number of space characters between date and time is determined by the global variable mbg_date_time_dist.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]ptPointer to a PCPS_HR_TIME structure providing date and time
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 655 of file mbgutil.c.

References cvt_to_time_t(), do_str_pcps_hr_date_time(), PCPS_TIME_STAMP::sec, PCPS_HR_TIME::tstamp, and PCPS_HR_TIME::utc_offs.

Referenced by mbg_str_pcps_hr_tstamp_loc().

◆ mbg_str_pcps_hr_date_time_utc()

int mbg_str_pcps_hr_date_time_utc ( char *  s,
int  max_len,
const PCPS_HR_TIME pt 
)

Write UTC date and time given as PCPS_HR_TIME structure to a string buffer.

The number of space characters between date and time is determined by the global variable mbg_date_time_dist.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]ptPointer to a PCPS_HR_TIME structure providing date and time
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 629 of file mbgutil.c.

References cvt_to_time_t(), do_str_pcps_hr_date_time(), PCPS_TIME_STAMP::sec, and PCPS_HR_TIME::tstamp.

Referenced by mbg_str_pcps_hr_tstamp_utc().

◆ mbg_str_pcps_hr_time()

int mbg_str_pcps_hr_time ( char *  s,
int  max_len,
uint32_t  sec 
)

Write time derived from seconds-since-epoch to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]secNumber of seconds since the epoch to be converted to date and time
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 563 of file mbgutil.c.

References cvt_to_time_t(), mbg_gmtime(), mbg_rc_is_success, mbg_str_time(), sn_cpy_str_safe(), and str_inv_cnv.

◆ mbg_str_pcps_hr_time_frac()

int mbg_str_pcps_hr_time_frac ( char *  s,
int  max_len,
uint32_t  frac 
)

Print binary PCPS_FRAC_32 fractions in decimal to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]fracBinary fractions of a second in PCPS_FRAC_32 format
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 679 of file mbgutil.c.

References bin_frac_32_to_dec_frac(), PCPS_HRT_FRAC_SCALE, PCPS_HRT_FRAC_SCALE_FMT, and snprintf_safe().

Referenced by mbg_str_pcps_hr_tstamp_loc(), and mbg_str_pcps_hr_tstamp_utc().

◆ mbg_str_pcps_hr_time_offs()

int mbg_str_pcps_hr_time_offs ( char *  s,
int  max_len,
const PCPS_HR_TIME pt,
const char *  info 
)

Print the UTC offset from a PCPS_HR_TIME structure to a string buffer.

The output format is sign - hours - minutes, e.g. "+01:45h". The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]ptPointer to a PCPS_HR_TIME structure providing date, and UTC offset
[in]infoAn informational text to be prepended
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 703 of file mbgutil.c.

References snprintf_safe(), and PCPS_HR_TIME::utc_offs.

Referenced by mbg_snprint_hr_time_loc(), mbg_str_pcps_hr_time_raw(), and mbg_str_pcps_hr_tstamp_loc().

◆ mbg_str_pcps_hr_time_raw()

int mbg_str_pcps_hr_time_raw ( char *  s,
int  max_len,
const PCPS_HR_TIME pt 
)

Write a raw high resolution time stamp plus converted local time to a string buffer.

The output string also has the time status code appended as hex number.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]ptPointer to a PCPS_HR_TIME structure providing date and time
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 831 of file mbgutil.c.

References mbg_str_pcps_hr_time_offs(), mbg_str_pcps_tstamp_raw(), snprintf_safe(), PCPS_HR_TIME::status, and PCPS_HR_TIME::tstamp.

◆ mbg_str_pcps_hr_tstamp_loc()

int mbg_str_pcps_hr_tstamp_loc ( char *  s,
int  max_len,
const PCPS_HR_TIME pt 
)

Write a high resolution local time stamp including fractions to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]ptPointer to a PCPS_HR_TIME structure providing date and time
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 765 of file mbgutil.c.

References PCPS_TIME_STAMP::frac, mbg_str_pcps_hr_date_time_loc(), mbg_str_pcps_hr_time_frac(), mbg_str_pcps_hr_time_offs(), PCPS_SCALE_GPS, PCPS_SCALE_TAI, PCPS_HR_TIME::status, and PCPS_HR_TIME::tstamp.

Referenced by mbg_str_ucap().

◆ mbg_str_pcps_hr_tstamp_utc()

int mbg_str_pcps_hr_tstamp_utc ( char *  s,
int  max_len,
const PCPS_HR_TIME pt 
)

Write a high resolution UTC time stamp including fractions to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]ptPointer to a PCPS_HR_TIME structure providing date and time
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 736 of file mbgutil.c.

References PCPS_TIME_STAMP::frac, mbg_str_pcps_hr_date_time_utc(), mbg_str_pcps_hr_time_frac(), and PCPS_HR_TIME::tstamp.

◆ mbg_str_pcps_time()

int mbg_str_pcps_time ( char *  s,
int  max_len,
const PCPS_TIME pt 
)

Write the time given as PCPS_TIME structure to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]ptPointer to a PCPS_TIME structure providing date and time
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 463 of file mbgutil.c.

References PCPS_TIME::hour, mbg_str_time(), PCPS_TIME::min, and PCPS_TIME::sec.

Referenced by mbg_str_pcps_date_time().

◆ mbg_str_pcps_time_long()

int mbg_str_pcps_time_long ( char *  s,
int  max_len,
const PCPS_TIME pt 
)

Write the time including sec100ths given as PCPS_TIME structure to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]ptPointer to a PCPS_TIME structure providing date and time
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 484 of file mbgutil.c.

References PCPS_TIME::hour, mbg_str_time_long(), PCPS_TIME::min, PCPS_TIME::sec, and PCPS_TIME::sec100.

◆ mbg_str_pcps_time_short()

int mbg_str_pcps_time_short ( char *  s,
int  max_len,
const PCPS_TIME pt 
)

Write the short time given as PCPS_TIME structure to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]ptPointer to a PCPS_TIME structure providing date and time
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 442 of file mbgutil.c.

References PCPS_TIME::hour, mbg_str_time_short(), and PCPS_TIME::min.

◆ mbg_str_pcps_tstamp_raw()

int mbg_str_pcps_tstamp_raw ( char *  s,
int  max_len,
const PCPS_TIME_STAMP pt 
)

Write a raw high resolution time stamp to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]ptPointer to a PCPS_HR_TIME structure providing date and time
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 808 of file mbgutil.c.

References PCPS_TIME_STAMP::frac, PCPS_TIME_STAMP::sec, and snprintf_safe().

Referenced by mbg_str_pcps_hr_time_raw().

◆ mbg_str_pos()

int mbg_str_pos ( char *  s,
int  max_len,
const POS ppos,
int  prec 
)

Write geographic coordinates to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]pposPointer to a POS structure containing the coordinates
[in]precNumber of digits of the geographic seconds after the decimal separator
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 925 of file mbgutil.c.

References ALT, LAT, POS::latitude, POS::lla, LON, POS::longitude, mbg_pos_dist, mbg_str_pos_alt(), mbg_str_pos_dms(), mbg_strchar(), mbg_strncpy(), and str_not_avail.

◆ mbg_str_pos_alt()

int mbg_str_pos_alt ( char *  s,
int  max_len,
double  alt 
)

Write a position's altitude parameter to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]altThe altitude parameter, in meters
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 904 of file mbgutil.c.

References snprintf_safe().

Referenced by mbg_str_pos().

◆ mbg_str_pos_dms()

int mbg_str_pos_dms ( char *  s,
int  max_len,
const DMS pdms,
int  prec 
)

Write a geographic coordinate in degrees - minutes - seconds to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]pdmsPointer to a DMS structure containing the coordinate
[in]precNumber of digits of the geographic seconds after the decimal separator
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 881 of file mbgutil.c.

References DMS::deg, DEG, DMS::min, DMS::prefix, DMS::sec, and snprintf_safe().

Referenced by mbg_str_pos().

◆ mbg_str_time()

int mbg_str_time ( char *  s,
int  max_len,
int  hour,
int  min,
int  sec 
)

Write a time string "hh:mm:ss" to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]hourHours number, 0..23
[in]minMinutes number, 0..59
[in]secSeconds number, 0..59, or 60 in case of leap second
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 320 of file mbgutil.c.

References mbg_str_time_short(), and snprintf_safe().

Referenced by do_str_pcps_hr_date_time(), mbg_str_pcps_hr_time(), mbg_str_pcps_time(), mbg_str_time_long(), and mbg_str_tm_gps_date_time().

◆ mbg_str_time_long()

int mbg_str_time_long ( char *  s,
int  max_len,
int  hour,
int  min,
int  sec,
int  sec100 
)

Write a long time string "hh:mm:ss.cc" to a string buffer.

Include 100ths of seconds. The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]hourHours number, 0..23
[in]minMinutes number, 0..59
[in]secSeconds number, 0..59, or 60 in case of leap second
[in]sec100Hundreths of seconds, 0..99
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 348 of file mbgutil.c.

References mbg_str_time(), and snprintf_safe().

Referenced by mbg_str_pcps_time_long().

◆ mbg_str_time_short()

int mbg_str_time_short ( char *  s,
int  max_len,
int  hour,
int  min 
)

Write a short time string "hh:mm" to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]hourHours number, 0..23
[in]minMinutes number, 0..59
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 297 of file mbgutil.c.

References snprintf_safe().

Referenced by mbg_str_pcps_time_short(), and mbg_str_time().

◆ mbg_str_tm_gps_date_time()

int mbg_str_tm_gps_date_time ( char *  s,
int  max_len,
const TM_GPS pt 
)

Write a full date and time string to a string buffer.

The number of space characters between date and time is determined by the global variable mbg_date_time_dist.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]ptPointer to a TM_GPS structure providing date and time
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 375 of file mbgutil.c.

References TM_GPS::hour, mbg_date_time_dist, mbg_str_date(), mbg_str_time(), mbg_strchar(), TM_GPS::mday, TM_GPS::min, TM_GPS::month, TM_GPS::sec, and TM_GPS::year.

◆ mbg_str_ucap()

int mbg_str_ucap ( char *  s,
int  max_len,
const PCPS_HR_TIME pt 
)

Write time capture / user capture time stamp to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]ptPointer to a PCPS_HR_TIME structure containing a user capture event
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 856 of file mbgutil.c.

References mbg_str_pcps_hr_tstamp_loc(), PCPS_HR_TIME::signal, and snprintf_safe().

◆ mbg_strchar()

int mbg_strchar ( char *  s,
size_t  max_len,
char  c,
size_t  n 
)

Write a character multiple times to a string buffer.

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the output buffer
[in]max_lenSize of the output buffer
[in]cThe character to write to the output buffer
[in]nThe number of characters to write to the output buffer
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 205 of file mbgutil.c.

Referenced by do_str_pcps_hr_date_time(), mbg_str_pcps_date_time(), mbg_str_pos(), and mbg_str_tm_gps_date_time().

◆ mbg_strncpy()

int mbg_strncpy ( char *  s,
size_t  max_len,
const char *  src 
)

A portable, safe implementation of strncpy()

The output string buffer is in any case properly terminated by 0.

Parameters
[out]sPointer to the destination string buffer
[in]max_lenSize of the destination string buffer
[in]srcPointer to the source string buffer
Returns
the number of characters written to the output buffer, except the terminating 0

Definition at line 184 of file mbgutil.c.

References sn_cpy_str_safe().

Referenced by mbg_str_pos().

◆ mbgutil_check_version()

int mbgutil_check_version ( int  header_version)

Check if the DLL/shared library is compatible with a given version.

If this library is used as a DLL/shared object library then the version number can be checked to see if the header files which are actually used to build an application are compatible with the header files which have been used to build the library, and thus the API functions are called in the correct way.

Parameters
[in]header_versionVersion number to be checked, should be MBGUTIL_VERSION from the mbgutil.h file version used to build the application
Returns
MBG_SUCCESS if compatible, else MBG_ERR_LIB_NOT_COMPATIBLE
See also
mbgutil_get_version
MBGUTIL_VERSION defined in mbgutil.h

Definition at line 128 of file mbgutil.c.

References MBG_ERR_LIB_NOT_COMPATIBLE, MBG_SUCCESS, and MBGUTIL_COMPAT_VERSION.

◆ mbgutil_get_version()

int mbgutil_get_version ( void  )

Get the version number of the precompiled DLL/shared object library.

If this library is used as a DLL/shared object library then the version number can be checked to see if the header files which are actually used to build an application are compatible with the header files which have been used to build the library, and thus the API function are called in the correct way.

Returns
The version number
See also
mbgutil_check_version
MBGUTIL_VERSION defined in mbgutil.h

Definition at line 102 of file mbgutil.c.

References MBGUTIL_VERSION.