A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
system-wall-clock-timestamp.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2020 Lawrence Livermore National Laboratory
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Peter D. Barnes, Jr. <pdbarnes@llnl.gov>
7
*/
8
9
#ifndef SYSTEM_WALL_CLOCK_TIMESTAMP_H
10
#define SYSTEM_WALL_CLOCK_TIMESTAMP_H
11
12
/**
13
* \file
14
* \ingroup system
15
* ns3::SystemWallClockTimestamp declaration.
16
*/
17
18
#include <ctime>
// ctime, time_t
19
#include <string>
20
21
namespace
ns3
22
{
23
24
/**
25
* Utility class to record the difference between two wall-clock times.
26
*/
27
class
SystemWallClockTimestamp
28
{
29
public
:
30
/** Constructor */
31
SystemWallClockTimestamp
();
32
33
/** Record the current wall-clock time and delta since the last stamp(). */
34
void
Stamp
();
35
36
/**
37
* Get the last time stamp as a string.
38
* \return The last time stamp.
39
*/
40
std::string
ToString
()
const
;
41
42
/**
43
* Get the last recorded raw value.
44
* \returns The last time stamp recorded.
45
*/
46
std::time_t
GetLast
()
const
;
47
48
/**
49
* Get the last recorded interval.
50
* \returns The interval between the last two time stamps.
51
*/
52
std::time_t
GetInterval
()
const
;
53
54
private
:
55
/** The last time stamp. */
56
std::time_t
m_last
;
57
58
/** Difference between the two previous time stamps. */
59
std::time_t
m_diff
;
60
61
};
// class SystemWallClockTimestamp
62
63
}
// namespace ns3
64
65
#endif
/* SYSTEM_WALL_CLOCK_TIMESTAMP_H */
ns3::SystemWallClockTimestamp
Utility class to record the difference between two wall-clock times.
Definition
system-wall-clock-timestamp.h:28
ns3::SystemWallClockTimestamp::GetInterval
std::time_t GetInterval() const
Get the last recorded interval.
Definition
system-wall-clock-timestamp.cc:50
ns3::SystemWallClockTimestamp::GetLast
std::time_t GetLast() const
Get the last recorded raw value.
Definition
system-wall-clock-timestamp.cc:44
ns3::SystemWallClockTimestamp::ToString
std::string ToString() const
Get the last time stamp as a string.
Definition
system-wall-clock-timestamp.cc:36
ns3::SystemWallClockTimestamp::SystemWallClockTimestamp
SystemWallClockTimestamp()
Constructor.
Definition
system-wall-clock-timestamp.cc:20
ns3::SystemWallClockTimestamp::m_diff
std::time_t m_diff
Difference between the two previous time stamps.
Definition
system-wall-clock-timestamp.h:59
ns3::SystemWallClockTimestamp::Stamp
void Stamp()
Record the current wall-clock time and delta since the last stamp().
Definition
system-wall-clock-timestamp.cc:28
ns3::SystemWallClockTimestamp::m_last
std::time_t m_last
The last time stamp.
Definition
system-wall-clock-timestamp.h:56
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
core
model
system-wall-clock-timestamp.h
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0