Skip to content
Snippets Groups Projects
Commit 86445bac authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Use armarx::{DateTime, Duration} as armem::{Time, Duration}

parent 01506819
No related branches found
No related tags found
1 merge request!228Resolve "Use armarx::Time as armem::Time instead of IceUtil::Time"
......@@ -11,12 +11,12 @@ namespace armarx
std::string armem::toStringMilliSeconds(const Time& time, int decimals)
{
std::stringstream ss;
ss << time.toMilliSeconds();
ss << time.toMicroSecondsSinceEpoch();
if (decimals > 0)
{
int div = int(std::pow(10, 3 - decimals));
ss << "." << std::setfill('0') << std::setw(decimals)
<< (time.toMicroSeconds() % 1000) / div;
<< (time.toMicroSecondsSinceEpoch() % 1000) / div;
}
ss << " ms";
return ss.str();
......@@ -27,7 +27,7 @@ namespace armarx
{
static const char* mu = "\u03BC";
std::stringstream ss;
ss << time.toMicroSeconds() << " " << mu << "s";
ss << time.toMicroSecondsSinceEpoch() << " " << mu << "s";
return ss.str();
}
......@@ -40,7 +40,7 @@ namespace armarx
{
int div = int(std::pow(10, 6 - decimals));
ss << "." << std::setfill('0') << std::setw(decimals)
<< (time.toMicroSeconds() % int(1e6)) / div;
<< (time.toMicroSecondsSinceEpoch() % int(1e6)) / div;
}
return ss.str();
......@@ -49,7 +49,7 @@ namespace armarx
armem::Time armem::timeFromStringMicroSeconds(const std::string& microSeconds)
{
return Time::microSeconds(std::stol(microSeconds));
return Time(Duration::MicroSeconds(std::stol(microSeconds)), ClockType::Virtual);
}
}
......
......@@ -2,13 +2,14 @@
#include <string>
#include <IceUtil/Time.h>
#include <ArmarXCore/core/time/DateTime.h>
#include <ArmarXCore/core/time/Duration.h>
#include "forward_declarations.h"
namespace armarx::armem
{
using Time = IceUtil::Time;
using Duration = IceUtil::Time;
/**
* @brief Returns `time` as e.g. "123456789.012 ms".
......
#pragma once
#include <ArmarXCore/core/time/forward_declarations.h>
namespace IceUtil
{
class Time;
}
namespace armarx::armem
{
using Time = IceUtil::Time;
using Duration = IceUtil::Time;
using Time = armarx::core::time::DateTime;
using Duration = armarx::core::time::Duration;
class MemoryID;
class Commit;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment