OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
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 
22 namespace OPALTimer {
23  // Class Timer
24  // ------------------------------------------------------------------------
25 
27  ::time(&timer);
28  }
29 
30 
32  {}
33 
34 
35  std::string Timer::date() const {
36  char buffer[12];
37  strftime(buffer, 12, "%d/%m/%Y", localtime(&timer));
38  return std::string(buffer, 10);
39  }
40 
41 
42  std::string Timer::time() const {
43  char buffer[12];
44  strftime(buffer, 12, "%H:%M:%S", localtime(&timer));
45  return std::string(buffer, 8);
46  }
47 }
Timer()
Constructor.
Definition: Timer.cpp:26
time_t timer
Definition: Timer.h:55
std::string date() const
Return date.
Definition: Timer.cpp:35
std::string time() const
Return time.
Definition: Timer.cpp:42