mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-21 05:05:38 -05:00
Phase 2 Audio Decoding
Phase 2 Audio Decoding Implemented XDMA decoder class implemented and set to default (-ft) --decoder class includes P25 1, 2, DMR BS/MS, and X2-TDMA -- -fr -T option reworked, -T now for Per Call, use -ft (default) Force Privacy Key --force privacy key use over system FID and SVC options. Per call now works on XDMA decoding and NXDN decoding Limited Phase 1 TSBK and Phase 2 LCCH handling (for Network Status Broadcast) --Need to get WACN, SYSID, and CC values for Phase 2 descrambling Fix most of the compiler warnings
This commit is contained in:
73
src/ezpwd/timeofday
Normal file
73
src/ezpwd/timeofday
Normal file
@@ -0,0 +1,73 @@
|
||||
#ifndef _EZPWD_TIMEOFDAY
|
||||
#define _EZPWD_TIMEOFDAY
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
//
|
||||
// ezpwd::timeofday -- Return current time.
|
||||
// ezpwd::epoch -- The UNIX epoch.
|
||||
// ezpwd::seconds -- convert timeval to a real-valued seconds
|
||||
// <timeval> < <timeval>-- less-than comparison on timevals
|
||||
// <timeval> - <timeval>-- difference on timevals
|
||||
//
|
||||
namespace ezpwd {
|
||||
inline
|
||||
timeval timeofday()
|
||||
{
|
||||
timeval tv;
|
||||
::gettimeofday( &tv, NULL );
|
||||
return tv;
|
||||
}
|
||||
|
||||
timeval epoch()
|
||||
{
|
||||
timeval tv;
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
return tv;
|
||||
}
|
||||
|
||||
inline
|
||||
double seconds( const timeval &rhs )
|
||||
{
|
||||
return rhs.tv_usec / 1000000.0 + rhs.tv_sec;
|
||||
}
|
||||
} // namespace ezpwd
|
||||
|
||||
inline
|
||||
bool operator<(
|
||||
const timeval &lhs,
|
||||
const timeval &rhs )
|
||||
{
|
||||
return ( lhs.tv_sec < rhs.tv_sec
|
||||
|| (( lhs.tv_sec == rhs.tv_sec )
|
||||
&& ( lhs.tv_usec < rhs.tv_usec )));
|
||||
}
|
||||
|
||||
inline
|
||||
timeval operator-(
|
||||
const timeval &lhs,
|
||||
timeval rhs ) // copy; adjusted...
|
||||
{
|
||||
timeval result;
|
||||
if ( lhs < rhs ) {
|
||||
result = ezpwd::epoch();
|
||||
} else {
|
||||
// See http://www.gnu.org/software/libc/manual/html_node/Elapsed-Time.html
|
||||
if ( lhs.tv_usec < rhs.tv_usec ) {
|
||||
int sec = ( rhs.tv_usec - lhs.tv_usec ) / 1000000 + 1;
|
||||
rhs.tv_usec -= sec * 1000000;
|
||||
rhs.tv_sec += sec;
|
||||
}
|
||||
if ( lhs.tv_usec - rhs.tv_usec > 1000000 ) {
|
||||
int sec = ( lhs.tv_usec - rhs.tv_usec ) / 1000000;
|
||||
rhs.tv_usec += sec * 1000000;
|
||||
rhs.tv_sec -= sec;
|
||||
}
|
||||
result.tv_sec = lhs.tv_sec - rhs.tv_sec;
|
||||
result.tv_usec = lhs.tv_usec - rhs.tv_usec;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // _EZPWD_TIMEOFDAY
|
||||
Reference in New Issue
Block a user