8#include "daq/slc/system/Time.h"
10#include "daq/slc/base/Reader.h"
11#include "daq/slc/base/Writer.h"
31Time::Time(
const double t)
36Time::Time(
const long s,
const long us)
48 if (MEGA <= labs(m_us)) {
50 m_us = m_us - (m_us / MEGA) * MEGA;
52 if (0 < m_s && m_us < 0) {
56 if (m_s < 0 && 0 < m_us) {
75void Time::set(
const double t)
80 m_us = (long)(us * 1000000);
84void Time::set(
const long s,
const long us)
91double Time::get()
const
93 return (
double)m_s + ((double)m_us) / 1000000.;
96long Time::getSecond()
const
101long Time::getMicroSecond()
const
106std::string Time::toString()
const
108 std::stringstream ss;
109 ss << m_s <<
"." << m_us;
113void Time::readObject(
Reader& r)
119void Time::writeObject(
Writer& w)
const
125bool Time::operator == (
const Time& t)
const
127 return (m_s == t.m_s) && (m_us == t.m_us);
130Time Time::operator + (
const Time& t)
const
138Time Time::operator - (
const Time& t)
const
Abstract base class for different kinds of events.