mbgtools-lx  4.2.8
nanotime.h
Go to the documentation of this file.
1 
2 /**************************************************************************
3  *
4  * $Id: nanotime.h 1.3 2018/11/21 11:27:26 martin REL_M $
5  *
6  * Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
7  *
8  * Description:
9  * Definitions and prototypes for nanotime.c
10  *
11  * -----------------------------------------------------------------------
12  * $Log: nanotime.h $
13  * Revision 1.3 2018/11/21 11:27:26 martin
14  * Include stdlib.h to provide size_t.
15  * Revision 1.2 2018/07/16 12:40:55 martin
16  * Include gpsdefs.h.
17  * Updated function prototypes.
18  * Revision 1.1 2017/06/12 08:49:09 martin
19  * Initial revision.
20  *
21  **************************************************************************/
22 
23 #ifndef _NANOTIME_H
24 #define _NANOTIME_H
25 
26 /* Other headers to be included */
27 
28 #include <words.h> // implicitly includes mbg_tgt.h, if required,
29  // and defines some basic structures
30 #include <gpsdefs.h>
31 
32 #include <stdlib.h>
33 
34 #ifdef _NANOTIME
35  #define _ext
36  #define _DO_INIT
37 #else
38  #define _ext extern
39 #endif
40 
41 
42 /* Start of header body */
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 
49 
50 
51 /* ----- function prototypes begin ----- */
52 
53 /* This section was generated automatically */
54 /* by MAKEHDR, do not remove the comments. */
55 
65  double nano_time_to_double( const NANO_TIME *p ) ;
66 
75  void double_to_nano_time( NANO_TIME *p, double d ) ;
76 
84  size_t snprint_nano_time( char *s, size_t max_len, const NANO_TIME *nt ) ;
85 
96 
106  double nano_time_64_to_double( const NANO_TIME_64 *p ) ;
107 
116  void double_to_nano_time_64( NANO_TIME_64 *p, double d ) ;
117 
125  size_t snprint_nano_time_64( char *s, size_t max_len, const NANO_TIME_64 *nt ) ;
126 
133  void str_s_to_nano_time_64( const char *s, NANO_TIME_64 *p ) ;
134 
141  void str_ms_to_nano_time_64( const char *s, NANO_TIME_64 *p ) ;
142 
153  int nano_time_64_to_tm_gps( TM_GPS *tm_gps, const NANO_TIME_64 *nt ) ;
154 
165  int tm_gps_to_nano_time_64( NANO_TIME_64 *nt, const TM_GPS *tm ) ;
166 
167 
168 /* ----- function prototypes end ----- */
169 
170 #ifdef __cplusplus
171 }
172 #endif
173 
174 
175 /* End of header body */
176 
177 #undef _ext
178 #undef _DO_INIT
179 
180 #endif /* _NANOTIME_H */
size_t snprint_nano_time(char *s, size_t max_len, const NANO_TIME *nt)
Print nano time into string buffer.
Definition: nanotime.c:102
A timestamp with nanosecond resolution, but 64 bit size.
Definition: words.h:621
Local date and time computed from GPS time.
Definition: gpsdefs.h:2593
double nano_time_to_double(const NANO_TIME *p)
Convert a NANO_TIME time to double.
Definition: nanotime.c:59
int tm_gps_to_nano_time_64(NANO_TIME_64 *nt, const TM_GPS *tm)
Convert TM_GPS to NANO_TIME_64.
Definition: nanotime.c:380
void normalize_nano_time_64(NANO_TIME_64 *nt)
Normalize a NANO_TIME_64 time.
Definition: nanotime.c:128
A timestamp with nanosecond resolution.
Definition: words.h:575
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.
Definition: nanotime.c:300
void double_to_nano_time_64(NANO_TIME_64 *p, double d)
Setup a NANO_TIME_64 structure from a time as double.
Definition: nanotime.c:184
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.
Definition: nanotime.c:315
int nano_time_64_to_tm_gps(TM_GPS *tm_gps, const NANO_TIME_64 *nt)
Convert NANO_TIME_64 to TM_GPS.
Definition: nanotime.c:341
void double_to_nano_time(NANO_TIME *p, double d)
Setup a NANO_TIME structure from a time provided as double.
Definition: nanotime.c:80
double nano_time_64_to_double(const NANO_TIME_64 *p)
Convert a NANO_TIME_64 time to double.
Definition: nanotime.c:163
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.
Definition: nanotime.c:204