rtl433  UNKNOWN
RTL-433 utility
r_util.h
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_R_UTIL_H_
13 #define INCLUDE_R_UTIL_H_
14 
15 #include <stdint.h>
16 #include <stdbool.h>
17 #include <time.h>
18 #include "compat_time.h"
19 
20 #if defined _MSC_VER // Microsoft Visual Studio
21  // MSC has something like C99 restrict as __restrict
22  #ifndef restrict
23  #define restrict __restrict
24  #endif
25 #endif
26 
27 // buffer to hold localized timestamp "YYYY-MM-DD HH:MM:SS.000000"
28 #define LOCAL_TIME_BUFLEN 32
29 
34 void get_time_now(struct timeval *tv);
35 
43 char *format_time_str(char *buf, char const *format, time_t time_secs);
44 
52 char *usecs_time_str(char *buf, char const *format, struct timeval *tv);
53 
60 char *sample_pos_str(float sample_file_pos, char *buf);
61 
67 float celsius2fahrenheit(float celsius);
68 
69 
75 float fahrenheit2celsius(float fahrenheit);
76 
77 
83 float kmph2mph(float kph);
84 
90 float mph2kmph(float kph);
91 
92 
98 float mm2inch(float mm);
99 
105 float inch2mm(float inch);
106 
107 
113 float kpa2psi(float kpa);
114 
120 float psi2kpa(float psi);
121 
122 
128 float hpa2inhg(float hpa);
129 
135 float inhg2hpa(float inhg);
136 
137 
144 bool str_endswith(const char *restrict str, const char *restrict suffix);
145 
155 char *str_replace(char *orig, char *rep, char *with);
156 
161 const char *nice_freq (double freq);
162 
163 #endif /* INCLUDE_R_UTIL_H_ */
float inch2mm(float inch)
Convert inches (inch) to millimeters (mm).
Definition: r_util.c:104
float hpa2inhg(float hpa)
Convert hecto Pascal (hPa) to inches of mercury (inHg).
Definition: r_util.c:121
float mm2inch(float mm)
Convert millimeters (mm) to inches (inch).
Definition: r_util.c:99
void get_time_now(struct timeval *tv)
Get current time with usec precision.
Definition: r_util.c:17
compat_time addresses compatibility time functions.
char * str_replace(char *orig, char *rep, char *with)
Replace a pattern in a string.
Definition: r_util.c:145
float celsius2fahrenheit(float celsius)
Convert Celsius to Fahrenheit.
Definition: r_util.c:76
bool str_endswith(const char *restrict str, const char *restrict suffix)
Return true if the string ends with the specified suffix, otherwise return false. ...
Definition: r_util.c:132
float psi2kpa(float psi)
Convert pounds per square inch (PSI) to kilo Pascal (kPa).
Definition: r_util.c:115
float inhg2hpa(float inhg)
Convert inches of mercury (inHg) to hecto Pascal (hPa).
Definition: r_util.c:126
float kmph2mph(float kph)
Convert Kilometers per hour (kph) to Miles per hour (mph).
Definition: r_util.c:88
Definition: mongoose.h:1208
char * format_time_str(char *buf, char const *format, time_t time_secs)
Printable timestamp in local time.
Definition: r_util.c:24
char * sample_pos_str(float sample_file_pos, char *buf)
Printable sample position.
Definition: r_util.c:70
float fahrenheit2celsius(float fahrenheit)
Convert Fahrenheit to Celsius.
Definition: r_util.c:82
float kpa2psi(float kpa)
Convert kilo Pascal (kPa) to pounds per square inch (PSI).
Definition: r_util.c:110
const char * nice_freq(double freq)
Make a nice printable string for a frequency.
Definition: r_util.c:193
float mph2kmph(float kph)
Convert Miles per hour (mph) to Kilometers per hour (kmph).
Definition: r_util.c:93
char * usecs_time_str(char *buf, char const *format, struct timeval *tv)
Printable timestamp in local time with microseconds.
Definition: r_util.c:49