Files
2014-06-30 13:58:10 +02:00

69 lines
1.8 KiB
C++

/*
* File: GenericTime.h
* Author: jgaebler
*
* Created on November 2, 2010, 3:39 PM
*/
#pragma once
#ifndef GENERICTIME_H
#define GENERICTIME_H
#include "common/Defines.h"
#include "BaseTime.h"
namespace ubeeme {
namespace moversight {
/**
* @brief Provides an generic time instance, abstracting the time used at a certain system.
* @author Jan Gäbler
* @ingroup Moversight
* @class GenericTime
*/
class GenericTime {
friend std::ostream & operator<<(std::ostream & out, const GenericTime & o);
public:
GenericTime();
GenericTime(int msec);
GenericTime(BaseTime t);
GenericTime(GenericTime const & orig);
GenericTime operator+(GenericTime const & t) const;
GenericTime operator-(GenericTime const & t) const;
GenericTime operator*(double const & v) const;
GenericTime operator/(GenericTime const & t) const;
bool operator<(GenericTime const & t) const;
bool operator>(GenericTime const & t) const;
GenericTime & operator= (const GenericTime & other);
BaseTime getTime() const;
double dbl() const;
int toMSecs() const;
GenericTime abs() const;
std::string toString();
static GenericTime currentTime();
static GenericTime fromString(std::string str);
private:
BaseTime time;
};
GenericTime operator*(double const a, GenericTime const & b);
GenericTime operator+(double const & t1, GenericTime const & t2);
};
};
#endif /* GENERICTIME_H */