[DEV/DEBUG] No stl start to work (add manual type declaration (NO RTTI))

This commit is contained in:
Edouard DUPIN 2017-09-17 00:12:49 +02:00
parent 209ac666cc
commit eff64f9759
8 changed files with 23 additions and 8 deletions

View File

@ -11,6 +11,9 @@
#include <echrono/debug.hpp>
#include <etk/UString.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(echrono::Clock);
echrono::Clock::Clock() :
m_data(0) {
@ -26,6 +29,11 @@ echrono::Clock::Clock(int64_t _valSec, int32_t _valNano) :
}
echrono::Clock::Clock(const echrono::Clock& _val):
m_data(_val.m_data) {
}
echrono::Clock::Clock(const echrono::Steady& _val) {
m_data = _val.get();
}

View File

@ -16,7 +16,7 @@ namespace echrono {
*/
class Clock {
private:
int64_t m_data;
int64_t m_data; // stored in ns
public:
Clock();
//Clock(const echrono::Duration& _val) {}; //value in second

View File

@ -10,6 +10,9 @@
#include <echrono/debug.hpp>
#include <etk/UString.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(echrono::Duration);
echrono::Duration::Duration() :
m_data(0) {

View File

@ -31,7 +31,7 @@ namespace echrono {
class Duration {
private:
int64_t m_data;
int64_t m_data; // stored in ns
public:
Duration();
Duration(int _val); //value in nanosecond

View File

@ -10,12 +10,14 @@
#include <echrono/debug.hpp>
#include <etk/UString.hpp>
#include <time.h>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(echrono::Steady);
static int64_t getTime() {
#if defined(__TARGET_OS__Android)
struct timevalnow;
gettimeofday(&now, nullptr);
return int64_t(now.tv_sec)*1000000LL + int64_t(now.tv_usec);
return int64_t(now.tv_sec)*1000000000LL + int64_t(now.tv_usec)*1000LL;
#elif defined(__TARGET_OS__Web) \
|| defined(__TARGET_OS__Linux) \
|| defined(__TARGET_OS__buildroot) \
@ -32,7 +34,7 @@ static int64_t getTime() {
now.tv_sec = time(nullptr);
now.tv_nsec = 0;
}
return int64_t(now.tv_sec)*1000000LL + int64_t(now.tv_nsec)/1000LL;
return int64_t(now.tv_sec)*1000000000LL + int64_t(now.tv_nsec);
#else
#error must be implemented ...
#endif

View File

@ -15,7 +15,7 @@ namespace echrono {
*/
class Steady {
private:
uint64_t m_data; //!< Monotonic clock since computer star
uint64_t m_data; //!< Monotonic clock since computer star (ns)
public:
Steady();
//Steady(const echrono::Duration& _val) {}; //value in second

View File

@ -13,12 +13,14 @@
extern "C" {
#include <time.h>
}
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(echrono::Time);
static int64_t getTime() {
#if defined(__TARGET_OS__Android)
struct timevalnow;
gettimeofday(&now, nullptr);
return int64_t(now.tv_sec)*1000000LL + int64_t(now.tv_usec);
return int64_t(now.tv_sec)*1000000000LL + int64_t(now.tv_usec)*1000LL;
#elif defined(__TARGET_OS__Web) \
|| defined(__TARGET_OS__Linux) \
|| defined(__TARGET_OS__buildroot) \
@ -31,7 +33,7 @@ static int64_t getTime() {
now.tv_sec = time(nullptr);
now.tv_nsec = 0;
}
return int64_t(now.tv_sec)*1000000LL + int64_t(now.tv_nsec)/1000LL;
return int64_t(now.tv_sec)*1000000000LL + int64_t(now.tv_nsec);
#else
#error must be implemented ...
#endif

View File

@ -15,7 +15,7 @@ namespace echrono {
*/
class Time {
private:
uint64_t m_data; //!< earth time since Epock
uint64_t m_data; //!< earth time since Epock in ns
public:
Time();
//Time(const echrono::Duration& _val) {}; //value in second