ed
include
ed
time.h
Go to the documentation of this file.
1
#ifndef ED_TIME_H_
2
#define ED_TIME_H_
3
4
#include <
iostream
>
5
6
namespace
ed
7
{
8
9
class
Time
10
{
11
12
public
:
13
14
Time
() :
secs_
(0) {}
15
16
Time
(
double
secs) :
secs_
(secs) {}
17
18
bool
operator<
(
const
Time
& rhs)
const
{
return
secs_
< rhs.
secs_
; }
19
20
friend
std::ostream
&
operator<<
(
std::ostream
& out,
const
Time
& d)
21
{
22
int
isecs = d.
secs_
;
23
24
int
h = isecs / 3600;
25
int
m = (isecs / 60) % 60;
26
int
s = isecs % 60;
27
int
ms = 1000 * (d.
secs_
- isecs);
28
29
out << h <<
":"
<< m <<
":"
<< s <<
":"
<< ms;
30
31
return
out;
32
}
33
34
inline
double
seconds
()
const
{
return
secs_
; }
35
36
private
:
37
38
double
secs_
;
39
40
};
41
42
}
// end namespace ed
43
44
#endif
ed::Time
Definition:
time.h:9
iostream
ed::Time::Time
Time()
Definition:
time.h:14
ed::Time::operator<<
friend std::ostream & operator<<(std::ostream &out, const Time &d)
Definition:
time.h:20
ed::Time::seconds
double seconds() const
Definition:
time.h:34
ed::Time::secs_
double secs_
Definition:
time.h:38
std::ostream
ed::Time::operator<
bool operator<(const Time &rhs) const
Definition:
time.h:18
ed::Time::Time
Time(double secs)
Definition:
time.h:16
ed
Definition:
convex_hull.h:8
Generated on Sun Feb 23 2025 04:34:40 for ed by
1.8.17