Stride Reference Manual  - generated for commit 9643b11
TimeStamp.h
Go to the documentation of this file.
1 /*
2  * This is free software: you can redistribute it and/or modify it
3  * under the terms of the GNU General Public License as published by
4  * the Free Software Foundation, either version 3 of the License, or
5  * any later version.
6  * The software is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  * You should have received a copy of the GNU General Public License
11  * along with the software. If not, see <http://www.gnu.org/licenses/>.
12  *
13  * Copyright 2017, Kuylen E, Willem L, Broeckhove J
14  */
15 
21 #pragma once
22 
23 #include <chrono>
24 #include <ostream>
25 #include <string>
26 
27 namespace stride {
28 namespace util {
29 
34 class TimeStamp
35 {
36 public:
38  TimeStamp();
39 
41  std::string ToString() const;
42 
44  std::string ToTag() const;
45 
46 private:
47  std::chrono::system_clock::time_point m_tp;
48 };
49 
53 inline std::ostream& operator<<(std::ostream& os, TimeStamp t) { return (os << t.ToString()); }
54 
55 } // namespace util
56 } // namespace stride
std::ofstream & operator<<(std::ofstream &ofs, const CSV &csv)
Definition: CSV.h:134
std::string ToString() const
Returns string with the time stamp after eliminating newline.
Definition: TimeStamp.cpp:33
TimeStamp()
Constructor marks the current time for the time stamp.
Definition: TimeStamp.cpp:31
Provides wall-clock time stamp using the time call.
Definition: TimeStamp.h:34
Namespace for the simulator and related classes.
Definition: Calendar.cpp:28
std::string ToTag() const
Returns string with the time stamp after eliminating newline.
Definition: TimeStamp.cpp:41
std::chrono::system_clock::time_point m_tp
Definition: TimeStamp.h:47