mbgtools-lx  4.2.8
pcpslstr.c File Reference
#include <pcpslstr.h>
#include <pcpsutil.h>
#include <mbgtime.h>
#include <timeutil.h>
#include <ctry.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

Go to the source code of this file.

Data Structures

struct  CLSTR_STATUS
 

Macros

#define _PCPSLSTR
 
#define _eos(_s)   ( &(_s)[strlen( _s )] )
 

Functions

const char * inv_str (void)
 Return a language dependend string for "invalid". More...
 
static const char * get_tz_name (PCPS_TIME_STATUS_X pcps_status, long utc_offs, ulong flags, int is_msf)
 Return a static string with the name of the timezone, depending on the UTC offset. More...
 
const char * pcps_tz_name (const PCPS_TIME *t, ulong flags, int is_msf)
 Return a static time zone string depending on the UTC offset from a PCPS_TIME structure. More...
 
const char * pcps_tz_name_from_hr_time (const PCPS_HR_TIME *hrt, ushort flags, int is_msf)
 Return a static time zone string depending on the UTC offset from a PCPS_HR_TIME structure. More...
 
const char * pcps_tz_name_hr_status (const PCPS_HR_TIME *t, ushort flags, int is_msf)
 Return a static time zone string depending on the UTC offset from a PCPS_HR_TIME structure. More...
 
const char * pcps_tz_name_from_status (PCPS_TIME_STATUS_X status)
 Return a static time zone string depending on the UTC offset from a PCPS_HR_TIME structure. More...
 
char * pcps_date_time_str (char *s, size_t max_len, const PCPS_TIME *t, int year_limit, const char *tz_str)
 
int pcps_str_tm_gps_date_time (char *s, size_t max_len, const TM_GPS *t)
 
static void pcps_setup_status_str (PCPS_STATUS_STR *pstr, int err_cond, CLSTR_STATUS *pss)
 
void pcps_status_strs (ushort status, int status_is_read, int is_gps, PCPS_STATUS_STRS *pstrs)
 
char * pcps_port_str (char *s, size_t max_len, const PCPS_DEV *pdev)
 
const char * pcps_tzcode_str (PCPS_TZCODE tzcode)
 
char * pcps_serial_str (char *s, size_t max_len, int i, const RECEIVER_PORT_CFG *p, const RECEIVER_INFO *p_ri, int short_strs)
 

Variables

static const char tz_name_utc [] = TZ_NAME_UTC
 
static CLSTR str_dst = { "DST", "Sommerzeit" }
 

Macro Definition Documentation

◆ _eos

#define _eos (   _s)    ( &(_s)[strlen( _s )] )

Definition at line 105 of file pcpslstr.c.

◆ _PCPSLSTR

#define _PCPSLSTR

Definition at line 91 of file pcpslstr.c.

Function Documentation

◆ get_tz_name()

static const char* get_tz_name ( PCPS_TIME_STATUS_X  pcps_status,
long  utc_offs,
ulong  flags,
int  is_msf 
)
static

Return a static string with the name of the timezone, depending on the UTC offset.

Parameters
[in]pcps_statusStatus flags read from a clock device
[in]utc_offsUTC offset in [s]
[in]flagsA combination of PCPS_TZ_NAME_FLAGS contolling the output string format
[in]is_msfA Flag used to indicate if the clock is an MSF receiver
Returns
Pointer to a static string which has been set up
See also
pcps_tz_name
pcps_tz_name_from_hr_time
pcps_tz_name_hr_status
pcps_tz_name_from_status
PCPS_TZ_NAME_FLAGS

Definition at line 158 of file pcpslstr.c.

References _lstr, lstr_bst, lstr_cest, lstr_cet, lstr_gmt, PCPS_DL_ENB, pcps_time_tz_dist, PCPS_TZ_NAME_APP_DST, PCPS_TZ_NAME_FORCE_UTC_OFFS, PCPS_UTC, SECS_PER_HOUR, sn_cpy_char_safe(), sn_cpy_str_safe(), snprint_utc_offs(), snprintf_safe(), str_dst, and tz_name_utc.

Referenced by pcps_tz_name(), and pcps_tz_name_from_hr_time().

◆ inv_str()

const char* inv_str ( void  )

Return a language dependend string for "invalid".

Returns
A language dependend string for "invalid"

Definition at line 131 of file pcpslstr.c.

References _lstr, and LCUE.

Referenced by pcps_tzcode_str().

◆ pcps_date_time_str()

char* pcps_date_time_str ( char *  s,
size_t  max_len,
const PCPS_TIME t,
int  year_limit,
const char *  tz_str 
)

◆ pcps_port_str()

char* pcps_port_str ( char *  s,
size_t  max_len,
const PCPS_DEV pdev 
)

Definition at line 522 of file pcpslstr.c.

References _pcps_short_port_base, and snprintf_safe().

◆ pcps_serial_str()

char* pcps_serial_str ( char *  s,
size_t  max_len,
int  i,
const RECEIVER_PORT_CFG p,
const RECEIVER_INFO p_ri,
int  short_strs 
)

◆ pcps_setup_status_str()

static void pcps_setup_status_str ( PCPS_STATUS_STR pstr,
int  err_cond,
CLSTR_STATUS pss 
)
static

◆ pcps_status_strs()

◆ pcps_str_tm_gps_date_time()

◆ pcps_tz_name()

const char* pcps_tz_name ( const PCPS_TIME t,
ulong  flags,
int  is_msf 
)

Return a static time zone string depending on the UTC offset from a PCPS_TIME structure.

Parameters
[in]tA PCPS_TIME structure read from a clock device
[in]flagsA combination of PCPS_TZ_NAME_FLAGS contolling the output string format
[in]is_msfA Flag used to indicate if the clock is an MSF receiver
Returns
Pointer to a static string which has been set up
See also
pcps_tz_name_from_hr_time
pcps_tz_name_hr_status
pcps_tz_name_from_status
get_tz_name
PCPS_TZ_NAME_FLAGS

Definition at line 245 of file pcpslstr.c.

References get_tz_name(), PCPS_TIME::offs_utc, SECS_PER_HOUR, and PCPS_TIME::status.

Referenced by print_pcps_time().

◆ pcps_tz_name_from_hr_time()

const char* pcps_tz_name_from_hr_time ( const PCPS_HR_TIME hrt,
ushort  flags,
int  is_msf 
)

Return a static time zone string depending on the UTC offset from a PCPS_HR_TIME structure.

Parameters
[in]hrtA PCPS_HR_TIME structure read from a clock device
[in]flagsA combination of PCPS_TZ_NAME_FLAGS contolling the output string format
[in]is_msfA Flag used to indicate if the clock is an MSF receiver
Returns
Pointer to a static string which has been set up
See also
pcps_tz_name
pcps_tz_name_hr_status
pcps_tz_name_from_status
get_tz_name
PCPS_TZ_NAME_FLAGS

Definition at line 269 of file pcpslstr.c.

References get_tz_name(), PCPS_HR_TIME::status, and PCPS_HR_TIME::utc_offs.

Referenced by pcps_tz_name_hr_status().

◆ pcps_tz_name_from_status()

const char* pcps_tz_name_from_status ( PCPS_TIME_STATUS_X  status)

Return a static time zone string depending on the UTC offset from a PCPS_HR_TIME structure.

This function can be used to build a name for the time zone if only the UTC/DST status is known, but the UTC offset is not. This is the case, for example, if the Meinberg standard time string is decoded.

Parameters
[in]statusClock status in PCPS_TIME_STATUS_X format
Returns
Pointer to a static string which has been set up
See also
pcps_tz_name
pcps_tz_name_from_hr_time
pcps_tz_name_hr_status
get_tz_name
PCPS_TZ_NAME_FLAGS

Definition at line 332 of file pcpslstr.c.

References _lstr, PCPS_DL_ENB, PCPS_UTC, str_dst, and tz_name_utc.

◆ pcps_tz_name_hr_status()

const char* pcps_tz_name_hr_status ( const PCPS_HR_TIME t,
ushort  flags,
int  is_msf 
)

Return a static time zone string depending on the UTC offset from a PCPS_HR_TIME structure.

This function can be used to build a name for the time zone if the timescale, the UTC/DST status and the UTC offset are known, e.g. from plug-in clock devices.

Parameters
[in]tA PCPS_HR_TIME structure read from a clock device
[in]flagsA combination of PCPS_TZ_NAME_FLAGS contolling the output string format
[in]is_msfA Flag used to indicate if the clock is an MSF receiver
Returns
Pointer to a static string which has been set up
See also
pcps_tz_name
pcps_tz_name_from_hr_time
pcps_tz_name_from_status
get_tz_name
PCPS_TZ_NAME_FLAGS

Definition at line 296 of file pcpslstr.c.

References PCPS_SCALE_GPS, PCPS_SCALE_TAI, pcps_tz_name_from_hr_time(), PCPS_HR_TIME::status, and strncpy_safe().

◆ pcps_tzcode_str()

const char* pcps_tzcode_str ( PCPS_TZCODE  tzcode)

Definition at line 540 of file pcpslstr.c.

References inv_str(), language, N_LNG, N_PCPS_TZCODE, and tzcode_name.

Variable Documentation

◆ str_dst

CLSTR str_dst = { "DST", "Sommerzeit" }
static

Definition at line 121 of file pcpslstr.c.

Referenced by get_tz_name(), and pcps_tz_name_from_status().

◆ tz_name_utc

const char tz_name_utc[] = TZ_NAME_UTC
static

Definition at line 120 of file pcpslstr.c.

Referenced by get_tz_name(), and pcps_tz_name_from_status().