mbgtools-lx  4.2.8
cmp_time_util.h
Go to the documentation of this file.
1 
2 /**************************************************************************
3  *
4  * $Id: cmp_time_util.h 1.2 2018/08/08 08:23:28 martin REL_M $
5  *
6  * Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
7  *
8  * Description:
9  * Definitions and prototypes for cmp_time_util.c.
10  *
11  * -----------------------------------------------------------------------
12  * $Log: cmp_time_util.h $
13  * Revision 1.2 2018/08/08 08:23:28 martin
14  * Moved some functions and structures to more convenient files.
15  * Fixed Windows build.
16  * Updated function prototypes.
17  * Revision 1.1 2013/07/25 10:42:59 martin
18  * Initial revision.
19  *
20  **************************************************************************/
21 
22 #ifndef _CMP_TIME_UTIL_H
23 #define _CMP_TIME_UTIL_H
24 
25 
26 /* Other headers to be included */
27 
28 #include <mbgdevio.h>
29 #include <deviohlp.h>
30 
31 #ifdef _CMP_TIME_UTIL
32  #define _ext
33  #define _DO_INIT
34 #else
35  #define _ext extern
36 #endif
37 
38 
39 /* Start of header body */
40 
41 #if 0 && defined( _USE_PACK ) // use default alignment
42  #pragma pack( 1 ) // set byte alignment
43  #define _USING_BYTE_ALIGNMENT
44 #endif
45 
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
52 
53 #if defined( MBG_TGT_WIN32 )
54  #define snprintf _snprintf
55 #endif
56 
57 
58 
59 /* ----- function prototypes begin ----- */
60 
61 /* This section was generated automatically */
62 /* by MAKEHDR, do not remove the comments. */
63 
75  int chk_fast_tstamp_supp( MBG_DEV_HANDLE dh1, const PCPS_DEV *p_dev_1, MBG_DEV_HANDLE dh2, const PCPS_DEV *p_dev_2, MBG_ERR_MSG_FNC err_msg_fnc ) ;
76 
89 
100  double get_htc_delta( const PCPS_HR_TIME_CYCLES *p_htc, const PCPS_HR_TIME_CYCLES *p_htc_ref, double *p_delta_ts, double *p_delta_cyc ) ;
101 
118  int mbg_snprint_hr_tstamp_ext( char *s, int max_len, const PCPS_TIME_STAMP *p, int print_raw ) ;
119 
135  int mbg_snprint_hr_time_loc( char *s, size_t max_len, const PCPS_HR_TIME *p ) ;
136 
137 
138 /* ----- function prototypes end ----- */
139 
140 #ifdef __cplusplus
141 }
142 #endif
143 
144 
145 #if defined( _USING_BYTE_ALIGNMENT )
146  #pragma pack() // set default alignment
147  #undef _USING_BYTE_ALIGNMENT
148 #endif
149 
150 /* End of header body */
151 
152 
153 #undef _ext
154 #undef _DO_INIT
155 
156 #endif /* _CMP_TIME_UTIL_H */
157 
int mbg_snprint_hr_time_loc(char *s, size_t max_len, const PCPS_HR_TIME *p)
Print local date and time from a PCPS_TIME_STAMP structure to a string.
static int print_raw
Definition: mbgcmptime.c:63
MBG_PC_CYCLES_FREQUENCY cyc_freq
Must be set up tby the application.
Definition: mbgcmptime.c:72
int get_htc_timestamps(MBG_DEV_HANDLE dh1, PCPS_HR_TIME_CYCLES *p_htc1, MBG_DEV_HANDLE dh2, PCPS_HR_TIME_CYCLES *p_htc2, int read_fast)
Read timestamps and cycles from both devices.
Definition: cmp_time_util.c:85
static int read_fast
Definition: mbgcmptime.c:59
int mbg_snprint_hr_tstamp_ext(char *s, int max_len, const PCPS_TIME_STAMP *p, int print_raw)
Print UTC date and time from a PCPS_TIME_STAMP structure to a string.
uint64_t MBG_PC_CYCLES_FREQUENCY
Definition: mbgpccyc.h:98
#define _ext
Definition: cmp_time_util.h:35
High resolution time including status and local time offset.
Definition: pcpsdefs.h:1085
High resolution time plus associated system cycles count.
Definition: pcpsdev.h:1392
A high resolution time stamp.
Definition: pcpsdefs.h:972
double get_htc_delta(const PCPS_HR_TIME_CYCLES *p_htc, const PCPS_HR_TIME_CYCLES *p_htc_ref, double *p_delta_ts, double *p_delta_cyc)
Compute the delta cycles and time difference.
int MBG_ERR_MSG_FNC(const PCPS_DEV *p_dev, const char *s)
Definition: deviohlp.h:75
int chk_fast_tstamp_supp(MBG_DEV_HANDLE dh1, const PCPS_DEV *p_dev_1, MBG_DEV_HANDLE dh2, const PCPS_DEV *p_dev_2, MBG_ERR_MSG_FNC err_msg_fnc)
Check if both devices support fast HR timestamps.
Definition: cmp_time_util.c:54
Device info structure.
Definition: pcpsdev.h:1043