OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
Timer.cpp
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2// $RCSfile: Timer.cpp,v $
3// ------------------------------------------------------------------------
4// $Revision: 1.1.1.1 $
5// ------------------------------------------------------------------------
6// Copyright: see Copyright.readme
7// ------------------------------------------------------------------------
8//
9// Class: Timer
10// Get Calendar date and time.
11//
12// ------------------------------------------------------------------------
13//
14// $Date: 2000/03/27 09:33:48 $
15// $Author: Andreas Adelmann $
16//
17// ------------------------------------------------------------------------
18
19#include "Utilities/Timer.h"
20#include <ctime>
21
22namespace OPALTimer {
23 // Class Timer
24 // ------------------------------------------------------------------------
25
27
29
30 std::string Timer::date() const {
31 char buffer[12];
32 strftime(buffer, 12, "%d/%m/%Y", localtime(&timer));
33 return std::string(buffer, 10);
34 }
35
36 std::string Timer::time() const {
37 char buffer[12];
38 strftime(buffer, 12, "%H:%M:%S", localtime(&timer));
39 return std::string(buffer, 8);
40 }
41} // namespace OPALTimer
time_t timer
Definition Timer.h:51
Timer()
Constructor.
Definition Timer.cpp:26
std::string time() const
Return time.
Definition Timer.cpp:36
std::string date() const
Return date.
Definition Timer.cpp:30
Timer class.
Definition Timer.cpp:22