rtl433
UNKNOWN
RTL-433 utility
|
Various utility functions for use by applications. More...
Functions | |
void | get_time_now (struct timeval *tv) |
Get current time with usec precision. More... | |
char * | format_time_str (char *buf, char const *format, time_t time_secs) |
Printable timestamp in local time. More... | |
char * | usecs_time_str (char *buf, char const *format, struct timeval *tv) |
Printable timestamp in local time with microseconds. More... | |
char * | sample_pos_str (float sample_file_pos, char *buf) |
Printable sample position. More... | |
float | celsius2fahrenheit (float celsius) |
Convert Celsius to Fahrenheit. More... | |
float | fahrenheit2celsius (float fahrenheit) |
Convert Fahrenheit to Celsius. More... | |
float | kmph2mph (float kmph) |
Convert Kilometers per hour (kph) to Miles per hour (mph). More... | |
float | mph2kmph (float mph) |
Convert Miles per hour (mph) to Kilometers per hour (kmph). More... | |
float | mm2inch (float mm) |
Convert millimeters (mm) to inches (inch). More... | |
float | inch2mm (float inch) |
Convert inches (inch) to millimeters (mm). More... | |
float | kpa2psi (float kpa) |
Convert kilo Pascal (kPa) to pounds per square inch (PSI). More... | |
float | psi2kpa (float psi) |
Convert pounds per square inch (PSI) to kilo Pascal (kPa). More... | |
float | hpa2inhg (float hpa) |
Convert hecto Pascal (hPa) to inches of mercury (inHg). More... | |
float | inhg2hpa (float inhg) |
Convert inches of mercury (inHg) to hecto Pascal (hPa). More... | |
bool | str_endswith (const char *restrict str, const char *restrict suffix) |
Return true if the string ends with the specified suffix, otherwise return false. More... | |
char * | str_replace (char *orig, char *rep, char *with) |
Replace a pattern in a string. More... | |
const char * | nice_freq (double freq) |
Make a nice printable string for a frequency. More... | |
Various utility functions for use by applications.
Copyright (C) 2015 Tommy Vestermark
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
float celsius2fahrenheit | ( | float | celsius | ) |
Convert Celsius to Fahrenheit.
celsius | temperature in Celsius |
Referenced by data_acquired_handler().
float fahrenheit2celsius | ( | float | fahrenheit | ) |
Convert Fahrenheit to Celsius.
celsius | temperature in Fahrenheit |
Referenced by data_acquired_handler().
char* format_time_str | ( | char * | buf, |
char const * | format, | ||
time_t | time_secs | ||
) |
Printable timestamp in local time.
buf[out] | output buffer, long enough for "YYYY-MM-DD HH:MM:SS" |
format | time format string, uses "%Y-%m-%d %H:%M:%S" if NULL |
time_secs | 0 for now, or seconds since the epoch |
Referenced by pulse_data_print_pulse_header(), pulse_data_print_vcd_header(), and time_pos_str().
void get_time_now | ( | struct timeval * | tv | ) |
Get current time with usec precision.
tv | output for current time |
References gettimeofday().
Referenced by sdr_callback(), and usecs_time_str().
float hpa2inhg | ( | float | hpa | ) |
Convert hecto Pascal (hPa) to inches of mercury (inHg).
kpa | pressure in kPa |
Referenced by data_acquired_handler().
float inch2mm | ( | float | inch | ) |
Convert inches (inch) to millimeters (mm).
inch | measurement in inches |
Referenced by data_acquired_handler().
float inhg2hpa | ( | float | inhg | ) |
Convert inches of mercury (inHg) to hecto Pascal (hPa).
kpa | pressure in inHg |
Referenced by data_acquired_handler().
float kmph2mph | ( | float | kph | ) |
Convert Kilometers per hour (kph) to Miles per hour (mph).
kph | speed in Kilometers per hour |
Referenced by data_acquired_handler().
float kpa2psi | ( | float | kpa | ) |
Convert kilo Pascal (kPa) to pounds per square inch (PSI).
kpa | pressure in kPa |
Referenced by data_acquired_handler().
float mm2inch | ( | float | mm | ) |
Convert millimeters (mm) to inches (inch).
mm | measurement in millimeters |
Referenced by data_acquired_handler().
float mph2kmph | ( | float | kph | ) |
Convert Miles per hour (mph) to Kilometers per hour (kmph).
mph | speed in Kilometers per hour |
Referenced by data_acquired_handler().
const char* nice_freq | ( | double | freq | ) |
Make a nice printable string for a frequency.
freq | the frequency to convert to a string. |
Referenced by pulse_data_print_vcd_header(), and sdr_set_center_freq().
float psi2kpa | ( | float | psi | ) |
Convert pounds per square inch (PSI) to kilo Pascal (kPa).
psi | pressure in PSI |
Referenced by data_acquired_handler().
char* sample_pos_str | ( | float | sample_file_pos, |
char * | buf | ||
) |
Printable sample position.
sample_pos | sample position |
buf | output buffer, long enough for "@0.000000s" |
Referenced by time_pos_str().
bool str_endswith | ( | const char *restrict | str, |
const char *restrict | suffix | ||
) |
Return true if the string ends with the specified suffix, otherwise return false.
str | string to search for patterns |
suffix | the pattern to search |
References strlen().
Referenced by data_acquired_handler().
char* str_replace | ( | char * | orig, |
char * | rep, | ||
char * | with | ||
) |
Replace a pattern in a string.
This utility function is useful when converting native units to si or customary.
orig | string to search for patterns |
rep | the pattern to replace |
with | the replacement pattern |
References strlen().
Referenced by data_acquired_handler().
char* usecs_time_str | ( | char * | buf, |
char const * | format, | ||
struct timeval * | tv | ||
) |
Printable timestamp in local time with microseconds.
buf[out] | output buffer, long enough for "YYYY-MM-DD HH:MM:SS.uuuuuu" |
format | time format string without usec, uses "%Y-%m-%d %H:%M:%S" if NULL |
tv | NULL for now, or seconds and microseconds since the epoch |
References get_time_now(), timeval::tv_sec, and timeval::tv_usec.
Referenced by time_pos_str().