General utilities.
More...
|
| uint8_t | ms_samplesize (char sampletype) |
| | Determine data sample size for each type.
|
| int | ms_encoding_sizetype (uint8_t encoding, uint8_t *samplesize, char *sampletype) |
| | Return sample size and/or type for given encoding value.
|
| const char * | ms_encodingstr (uint8_t encoding) |
| | Descriptive string for data encodings.
|
| const char * | ms_errorstr (int errorcode) |
| | Descriptive string for library Return codes.
|
| nstime_t | ms_sampletime (nstime_t time, int64_t offset, double samprate) |
| | Calculate the time of a sample in an array.
|
| int | ms_bigendianhost (void) |
| | Runtime test for host endianess.
|
| int64_t | lmp_ftell64 (FILE *stream) |
| int | lmp_fseek64 (FILE *stream, int64_t offset, int whence) |
| uint64_t | lmp_nanosleep (uint64_t nanoseconds) |
| | Sleep for a specified number of nanoseconds.
|
| nstime_t | lmp_systemtime (void) |
| | Return the current system time.
|
| int | lmp_strncasecmp (const char *s1, const char *s2, size_t n) |
| | Case-insensitive, ASCII-only string comparison.
|
| uint32_t | ms_crc32c (const uint8_t *input, int length, uint32_t previousCRC32C) |
General utilities.
◆ ms_dabs
Value:DEPRECATED legacy implementation of fabs(), now a macro
◆ ms_samplesize()
| uint8_t ms_samplesize |
( |
char | sampletype | ) |
|
|
extern |
Determine data sample size for each type.
- Parameters
-
| [in] | sampletype | Library sample type code:
't' - Text data type
'i' - 32-bit integer data type
'f' - 32-bit float data type
'd' - 64-bit float (double) data type
|
- Returns
- The sample size based on type code or 0 for unknown.
◆ ms_encoding_sizetype()
| int ms_encoding_sizetype |
( |
uint8_t | encoding, |
|
|
uint8_t * | samplesize, |
|
|
char * | sampletype ) |
|
extern |
Return sample size and/or type for given encoding value.
Determine the decoded sample size and/or type based on data encoding. The samplesize and sampletype values will only be set if not NULL, allowing lookup of either value or both.
- Parameters
-
| [in] | encoding | Data sample encoding code |
| [out] | samplesize | Size of sample, pointer that will be set |
| [out] | sampletype | Sample type, pointer to char that will be set |
- Returns
- 0 on success, -1 on error
◆ ms_encodingstr()
| const char * ms_encodingstr |
( |
uint8_t | encoding | ) |
|
|
extern |
Descriptive string for data encodings.
- Parameters
-
| [in] | encoding | Data sample encoding code |
- Returns
- a string describing a data encoding format
◆ ms_errorstr()
| const char * ms_errorstr |
( |
int | errorcode | ) |
|
|
extern |
Descriptive string for library Return codes.
- Parameters
-
| [in] | errorcode | Library error code |
- Returns
- a string describing the library error code or NULL if the code is unknown.
◆ ms_sampletime()
Calculate the time of a sample in an array.
Given a time, sample offset and sample rate/period calculate the time of the sample at the offset.
If samprate is negative the negated value is interpreted as a sample period in seconds, otherwise the value is assumed to be a sample rate in Hertz.
If leap seconds have been loaded into the internal library list: when a time span, from start to offset, completely contains a leap second, starts before and ends after, the calculated sample time will be adjusted (reduced) by one second.
- Note
- On the epoch time scale the value of a leap second is the same as the second following the leap second, without external information the values are ambiguous.
- See also
- ms_readleapsecondfile()
- Parameters
-
| [in] | time | Time value for first sample in array |
| [in] | offset | Offset of sample to calculate time of |
| [in] | samprate | Sample rate (when positive) or period (when negative) |
- Returns
- Time of the sample at specified offset
◆ ms_bigendianhost()
| int ms_bigendianhost |
( |
void | | ) |
|
|
externinline |
Runtime test for host endianess.
- Returns
- 1 if the host is big endian, 0 otherwise.
◆ lmp_ftell64()
| int64_t lmp_ftell64 |
( |
FILE * | stream | ) |
|
|
extern |
Portable version of POSIX ftello() to get file position in large files
◆ lmp_fseek64()
| int lmp_fseek64 |
( |
FILE * | stream, |
|
|
int64_t | offset, |
|
|
int | whence ) |
|
extern |
Portable version of POSIX fseeko() to set position in large files
◆ lmp_nanosleep()
| uint64_t lmp_nanosleep |
( |
uint64_t | nanoseconds | ) |
|
|
extern |
Sleep for a specified number of nanoseconds.
Portable version of POSIX nanosleep() to sleep for nanoseconds
Sleep for a given number of nanoseconds. Under WIN use SleepEx() and is limited to millisecond resolution. For all others use the POSIX.4 nanosleep(), which can be interrupted by signals.
- Parameters
-
| nanoseconds | Nanoseconds to sleep |
- Returns
- On non-WIN: the remaining nanoseconds are returned if the requested interval is interrupted.
◆ lmp_systemtime()
Return the current system time.
Portable function to return the current system time
Current system time is returned as an nstime_t value. Under Windows this has millisecond precision as returned by _ftime_s() and for all other platforms the precision returned by gettimeofday() up to microseconds.
- Returns
- nstime_t Current system time on success, NSTERROR on error
◆ lmp_strncasecmp()
| int lmp_strncasecmp |
( |
const char * | s1, |
|
|
const char * | s2, |
|
|
size_t | n ) |
|
extern |
Case-insensitive, ASCII-only string comparison.
Portable function for case-insensitive, ASCII-only string comparison
Compare two strings up to n characters, ignoring case. This function is ASCII-only and does not handle multibyte characters.
- Parameters
-
| [in] | s1 | First string to compare |
| [in] | s2 | Second string to compare |
| [in] | n | Maximum number of characters to compare |
- Returns
- 0 if the strings are equal, a non-zero value otherwise
◆ ms_crc32c()
| uint32_t ms_crc32c |
( |
const uint8_t * | input, |
|
|
int | length, |
|
|
uint32_t | previousCRC32C ) |
|
extern |
Return CRC32C value of supplied buffer, with optional starting CRC32C value