some fixes [multithreading,..]

needed interface changes [new options]
logger for android
wifi-ap-optimization
new test-cases
This commit is contained in:
2016-09-28 12:19:14 +02:00
parent 91e3367372
commit 4f511d907e
62 changed files with 1418 additions and 175 deletions

View File

@@ -1,6 +1,8 @@
#ifndef TIMESTAMP_H
#define TIMESTAMP_H
#include <chrono>
/**
* helper-class to handle timestamps
*/
@@ -25,16 +27,32 @@ public:
/** get timestamp from the given value which represents seconds */
static inline Timestamp fromSec(const float sec) {return Timestamp(sec*1000);}
/** get timestamp for the current unix-time */
static inline Timestamp fromUnixTime() {
auto now = std::chrono::system_clock::now();
auto duration = now.time_since_epoch();
auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();
return Timestamp(millis);
}
/** get timestamp for the current system-time */
static inline Timestamp fromRunningTime() {
static Timestamp startup = fromUnixTime();
return fromUnixTime() - startup;
}
public:
/** get timestamp in milliseconds */
inline uint64_t ms() const {return _ms;}
inline int64_t ms() const {return _ms;}
/** get timestamp in seconds */
inline float sec() const {return _ms/1000.0f;}
public:
/** is this timestamp zero? */
@@ -48,17 +66,23 @@ public:
/** smaller than the given one? */
bool operator < (const Timestamp& o) const {return _ms < o._ms;}
bool operator <= (const Timestamp& o) const {return _ms <= o._ms;}
/** greater than the given one? */
bool operator > (const Timestamp& o) const {return _ms > o._ms;}
bool operator >= (const Timestamp& o) const {return _ms >= o._ms;}
Timestamp operator - (const Timestamp& o) const {return Timestamp(_ms - o._ms);}
Timestamp operator + (const Timestamp& o) const {return Timestamp(_ms + o._ms);}
/** cast to float */
operator float () const {return sec();}
Timestamp operator * (const float val) const {return Timestamp(_ms * val);}
// /** cast to float */
// operator float () const {return sec();}
};