FreeNOS
lib
libapp
SystemClock.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2020 Niek Linnenbank
3
*
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation, either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef __LIB_LIBAPP_SYSTEMCLOCK_H
19
#define __LIB_LIBAPP_SYSTEMCLOCK_H
20
21
#include <
sys/time.h
>
22
34
class
SystemClock
35
{
36
public
:
37
41
enum
Result
42
{
43
Success
,
44
IOError
45
};
46
47
public
:
48
52
SystemClock
();
53
59
void
value
(
struct
timeval
& val)
const
;
60
66
Result
now
();
67
73
void
printDiff
(
const
SystemClock
& clock)
const
;
74
80
void
printDiff
(
const
struct
timeval
& stamp)
const
;
81
82
private
:
83
85
struct
timeval
m_timeval
;
86
};
87
93
#endif
/* __LIB_LIBAPP_SYSTEMCLOCK_H */
SystemClock::IOError
@ IOError
Definition:
SystemClock.h:44
SystemClock::value
void value(struct timeval &val) const
Get time value.
Definition:
SystemClock.cpp:29
SystemClock::m_timeval
struct timeval m_timeval
Time value.
Definition:
SystemClock.h:85
SystemClock::printDiff
void printDiff(const SystemClock &clock) const
Print difference between two clocks to stdout.
Definition:
SystemClock.cpp:49
time.h
SystemClock
Provides an abstract interface to the system clock.
Definition:
SystemClock.h:34
SystemClock::Success
@ Success
Definition:
SystemClock.h:43
SystemClock::SystemClock
SystemClock()
Constructor.
Definition:
SystemClock.cpp:23
timeval
Time value information.
Definition:
time.h:35
SystemClock::now
Result now()
Get the current time.
Definition:
SystemClock.cpp:35
SystemClock::Result
Result
Result codes.
Definition:
SystemClock.h:41
Generated by
1.8.17