w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
Rtime.hpp
Go to the documentation of this file.
1// $Id: Rtime.hpp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2017-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2018-12-22 1091 1.0.1 Drop empty dtors for pod-only classes
8// 2017-02-19 853 1.0 Initial version
9// ---------------------------------------------------------------------------
10
15#ifndef included_Retro_Rtime
16#define included_Retro_Rtime 1
17
18#include <time.h>
19
20#include <ostream>
21#include <string>
22
23namespace Retro {
24
25 class Rtime {
26 public:
27 Rtime();
28 explicit Rtime(clockid_t clkid);
29 explicit Rtime(double dt);
30
31 void GetClock(clockid_t clkid);
32 void SetSec(time_t sec);
33 void SetNSec(long nsec);
34 void Set(const struct timespec& ts);
35 void Set(double dt);
36 void Clear();
37
38 bool IsZero() const;
39 bool IsPositive() const;
40 bool IsNegative() const;
41
42 time_t Sec() const;
43 long NSec() const;
44 const struct timespec& Timespec() const;
45 int ToMSec() const;
46 double ToDouble() const;
47 std::string ToString() const;
48 double Age(clockid_t clkid) const;
49
50 void Print(std::ostream& os) const;
51 void Dump(std::ostream& os, int ind=0, const char* text=0) const;
52
53 explicit operator double() const;
54
55 Rtime& operator+=(const Rtime& rhs);
56 Rtime& operator-=(const Rtime& rhs);
57
58 bool operator==(const Rtime& rhs);
59 bool operator!=(const Rtime& rhs);
60 bool operator<(const Rtime& rhs);
61 bool operator<=(const Rtime& rhs);
62 bool operator>(const Rtime& rhs);
63 bool operator>=(const Rtime& rhs);
64
65 protected:
66 void Fixup();
67
68 private:
69 struct timespec fTime;
70 };
71
72 Rtime operator+(const Rtime& x, const Rtime& y);
73 Rtime operator-(const Rtime& x, const Rtime& y);
74
75 std::ostream& operator<<(std::ostream& os, const Rtime& obj);
76
77} // end namespace Retro
78
79#include "Rtime.ipp"
80
81#endif
FIXME_docs.
Definition: Rtime.hpp:25
bool IsZero() const
FIXME_docs.
Definition: Rtime.ipp:85
bool IsNegative() const
FIXME_docs.
Definition: Rtime.ipp:101
bool operator!=(const Rtime &rhs)
FIXME_docs.
Definition: Rtime.ipp:189
std::string ToString() const
FIXME_docs.
Definition: Rtime.cpp:62
const struct timespec & Timespec() const
FIXME_docs.
Definition: Rtime.ipp:125
int ToMSec() const
FIXME_docs.
Definition: Rtime.ipp:133
void Print(std::ostream &os) const
FIXME_docs.
Definition: Rtime.cpp:82
time_t Sec() const
FIXME_docs.
Definition: Rtime.ipp:109
void Set(const struct timespec &ts)
FIXME_docs.
Definition: Rtime.ipp:56
bool IsPositive() const
FIXME_docs.
Definition: Rtime.ipp:93
void SetNSec(long nsec)
FIXME_docs.
Definition: Rtime.cpp:52
void Clear()
FIXME_docs.
Definition: Rtime.ipp:76
void Fixup()
FIXME_docs.
Definition: Rtime.ipp:233
Rtime & operator+=(const Rtime &rhs)
FIXME_docs.
Definition: Rtime.ipp:158
void SetSec(time_t sec)
FIXME_docs.
Definition: Rtime.ipp:48
void Dump(std::ostream &os, int ind=0, const char *text=0) const
FIXME_docs.
Definition: Rtime.cpp:103
bool operator<=(const Rtime &rhs)
FIXME_docs.
Definition: Rtime.ipp:207
struct timespec fTime
time
Definition: Rtime.hpp:69
bool operator>(const Rtime &rhs)
FIXME_docs.
Definition: Rtime.ipp:217
void GetClock(clockid_t clkid)
FIXME_docs.
Definition: Rtime.cpp:41
bool operator>=(const Rtime &rhs)
FIXME_docs.
Definition: Rtime.ipp:225
Rtime & operator-=(const Rtime &rhs)
FIXME_docs.
Definition: Rtime.ipp:169
Rtime()
Default constructor.
Definition: Rtime.ipp:25
bool operator<(const Rtime &rhs)
FIXME_docs.
Definition: Rtime.ipp:197
double ToDouble() const
FIXME_docs.
Definition: Rtime.ipp:142
double Age(clockid_t clkid) const
FIXME_docs.
Definition: Rtime.cpp:72
bool operator==(const Rtime &rhs)
FIXME_docs.
Definition: Rtime.ipp:180
long NSec() const
FIXME_docs.
Definition: Rtime.ipp:117
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47
Rtime operator+(const Rtime &x, const Rtime &y)
std::ostream & operator<<(std::ostream &os, const RerrMsg &obj)
Rtime operator-(const Rtime &x, const Rtime &y)