[DEBUG] correct time in ad out and display
This commit is contained in:
parent
4927212da3
commit
7b6245023b
@ -52,3 +52,5 @@ namespace echrono {
|
||||
std::ostream& operator <<(std::ostream& _os, const echrono::Clock& _obj);
|
||||
}
|
||||
|
||||
|
||||
#include <echrono/Duration.hpp>
|
||||
|
@ -74,8 +74,8 @@ bool echrono::Duration::operator>= (const echrono::Duration& _obj) const {
|
||||
return m_data >= _obj.m_data;
|
||||
}
|
||||
|
||||
float echrono::Duration::toSeconds() const {
|
||||
return float(double(m_data.count()) * 0.000000001);
|
||||
double echrono::Duration::toSeconds() const {
|
||||
return double(m_data.count()) * 0.000000001;
|
||||
}
|
||||
|
||||
const echrono::Duration& echrono::Duration::operator/= (float _value) {
|
||||
|
@ -51,7 +51,7 @@ namespace echrono {
|
||||
Duration operator++(int _unused);
|
||||
Duration& operator--();
|
||||
Duration operator--(int _unused);
|
||||
float toSeconds() const;
|
||||
double toSeconds() const;
|
||||
void reset();
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const echrono::Duration& _obj);
|
||||
|
@ -50,3 +50,6 @@ namespace echrono {
|
||||
std::ostream& operator <<(std::ostream& _os, const echrono::Steady& _obj);
|
||||
}
|
||||
|
||||
|
||||
#include <echrono/Duration.hpp>
|
||||
|
||||
|
@ -125,6 +125,7 @@ int64_t echrono::Time::count() {
|
||||
}
|
||||
|
||||
std::ostream& echrono::operator <<(std::ostream& _os, const echrono::Time& _obj) {
|
||||
/*
|
||||
std::chrono::nanoseconds ns = std::chrono::duration_cast<std::chrono::nanoseconds>(_obj.get().time_since_epoch());
|
||||
int64_t totalSecond = ns.count()/1000000000;
|
||||
int64_t millisecond = (ns.count()%1000000000)/1000000;
|
||||
@ -135,7 +136,7 @@ std::ostream& echrono::operator <<(std::ostream& _os, const echrono::Time& _obj)
|
||||
int32_t minute = (totalSecond/60)%60;
|
||||
int32_t hour = (totalSecond/3600)%24;
|
||||
int32_t day = (totalSecond/(24*3600))%365;
|
||||
int32_t year = totalSecond/(24*3600*365);
|
||||
int32_t year = totalSecond/(24*3600*365) + 1970;
|
||||
bool start = false;
|
||||
if (year != 0) {
|
||||
start = true;
|
||||
@ -166,6 +167,9 @@ std::ostream& echrono::operator <<(std::ostream& _os, const echrono::Time& _obj)
|
||||
_os << microsecond << "us ";
|
||||
}
|
||||
_os << nanosecond << "ns ";
|
||||
*/
|
||||
std::time_t now_c = std::chrono::system_clock::to_time_t(_obj.get());
|
||||
_os << std::put_time(std::localtime(&now_c), "%F %T");
|
||||
return _os;
|
||||
}
|
||||
|
||||
|
@ -53,3 +53,4 @@ namespace echrono {
|
||||
std::ostream& operator <<(std::ostream& _os, const echrono::Time& _obj);
|
||||
}
|
||||
|
||||
#include <echrono/Duration.hpp>
|
||||
|
Loading…
x
Reference in New Issue
Block a user