mbgtools-lx  4.2.8
pcpsutil.h
Go to the documentation of this file.
1 
2 /**************************************************************************
3  *
4  * $Id: pcpsutil.h 1.25 2018/12/11 16:06:02 martin EXP $
5  *
6  * Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
7  *
8  * Description:
9  * Definitions and prototypes for pcpsutil.c.
10  *
11  * -----------------------------------------------------------------------
12  * $Log: pcpsutil.h $
13  * Revision 1.25 2018/12/11 16:06:02 martin
14  * Use standard int types for more compatibility.
15  * Revision 1.24 2018/09/17 12:34:20Z martin
16  * Fixed a compiler warning.
17  * Revision 1.23 2017/05/10 15:26:09Z martin
18  * Tiny cleanup.
19  * Revision 1.22 2017/03/17 11:45:51 martin
20  * Moved binary fraction conversion functions to cfg_hlp.h.
21  * Revision 1.21 2015/10/26 16:09:58 martin
22  * Moved definition of PCPS_SER_PACK to deviohlp.h.
23  * The .c file is now obsolete, so there are no prototypes anymore.
24  * Revision 1.20 2014/07/22 12:22:27Z martin
25  * Fixed a compiler warning.
26  * Revision 1.19 2014/07/14 15:43:23Z martin
27  * Updated doxygen comment.
28  * Revision 1.18 2014/06/26 14:52:50 martin
29  * Fixed build on targets not supporting 64 bit types.
30  * Updated some comments to doxygen format.
31  * Revision 1.17 2014/05/27 10:39:33Z martin
32  * More inline functions to convert binary fractions by thomas-b.
33  * Moved definitions of some signal constants to pcpsdefs.h.
34  * Revision 1.16 2013/03/04 15:51:02Z martin
35  * Added dfrac_sec_from_bin().
36  * Revision 1.15 2012/10/15 09:41:32 martin
37  * Cleaned up handling of pragma pack().
38  * Revision 1.14 2009/03/09 13:39:45 martin
39  * Made pcps_exp_year() an inline function.
40  * Revision 1.13 2008/12/10 19:59:48 martin
41  * Made frac_sec_from_bin() an inline function.
42  * Revision 1.12 2008/11/25 09:59:01 martin
43  * Moved definitions of PCPS_HRT_FRAC_SCALE and
44  * PCPS_HRT_FRAC_SCALE_FMT to pcpsdefs.h.
45  * Revision 1.11 2006/06/29 10:15:02Z martin
46  * Updated function prototypes.
47  * Revision 1.10 2005/01/14 10:16:12Z martin
48  * Updated function prototypes.
49  * Revision 1.9 2004/11/09 14:30:50Z martin
50  * Redefined interface data types using C99 fixed-size definitions.
51  * Updated function prototypes.
52  * Revision 1.8 2004/04/14 09:22:09Z martin
53  * Pack structures 1 byte aligned.
54  * Revision 1.7 2001/11/28 14:41:25Z MARTIN
55  * Changed PCPS_HRT_FRAC_SCALE and PCPS_HRT_FRAC_SCALE_FMT
56  * to print 7 rather than 6 digits.
57  * Revision 1.6 2001/09/14 11:59:33 MARTIN
58  * Support for PCPS_HR_TIME fraction conversion.
59  * Updated function prototypes.
60  * Revision 1.5 2001/08/14 12:06:44 MARTIN
61  * Defined constants used to draw a signal bar
62  * depending on a DCF77 clock's signal value.
63  * Revision 1.4 2001/03/01 14:03:18 MARTIN
64  * Updated function prototypes.
65  * Revision 1.3 2000/08/31 14:06:05 MARTIN
66  * Updated function prototypes.
67  * Revision 1.2 2000/07/21 13:43:40 MARTIN
68  * Initial revision
69  *
70  **************************************************************************/
71 
72 #ifndef _PCPSUTIL_H
73 #define _PCPSUTIL_H
74 
75 
76 /* Other headers to be included */
77 
78 #include <pcpsdefs.h>
79 #include <use_pack.h>
80 
81 
82 #ifdef _PCPSUTIL
83  #define _ext
84 #else
85  #define _ext extern
86 #endif
87 
88 
89 /* Start of header body */
90 
91 #if defined( _USE_PACK )
92  #pragma pack( 1 ) // set byte alignment
93  #define _USING_BYTE_ALIGNMENT
94 #endif
95 
96 #ifdef __cplusplus
97 extern "C" {
98 #endif
99 
100 
112 static __mbg_inline
113 int pcps_exp_year( int year, int year_lim )
114 {
115  int lyear = year + year_lim - ( year_lim % 100 );
116 
117  if ( lyear < year_lim )
118  lyear += 100;
119 
120  return lyear;
121 
122 } // pcps_exp_year
123 
124 
125 
126 /* ----- function prototypes begin ----- */
127 
128 /* This section was generated automatically */
129 /* by MAKEHDR, do not remove the comments. */
130 
131 /* (no header definitions found) */
132 
133 /* ----- function prototypes end ----- */
134 
135 #ifdef __cplusplus
136 }
137 #endif
138 
139 
140 
141 #if defined( _USING_BYTE_ALIGNMENT )
142  #pragma pack() // set default alignment
143  #undef _USING_BYTE_ALIGNMENT
144 #endif
145 
146 /* End of header body */
147 
148 #undef _ext
149 
150 
151 #endif /* _PCPSUTIL_H */
static __mbg_inline int pcps_exp_year(int year, int year_lim)
Expand a 2-digit year number to a 4-digit year number.
Definition: pcpsutil.h:113