[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 <echrono/debug.hpp>
#include <etk/UString.hpp> #include <etk/UString.hpp>
#include <etk/typeInfo.hpp>
ETK_DECLARE_TYPE(echrono::Clock);
echrono::Clock::Clock() : echrono::Clock::Clock() :
m_data(0) { 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) { echrono::Clock::Clock(const echrono::Steady& _val) {
m_data = _val.get(); m_data = _val.get();
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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