1 #ifndef __JSYSTEM__JDATE__
2 #define __JSYSTEM__JDATE__
14 namespace JPP {
using namespace JSYSTEM; }
26 static const int MAX_SIZE = 256;
27 static char buffer[MAX_SIZE];
31 strftime(buffer, MAX_SIZE,
"%x", localtime(&ts));
45 static const int MAX_SIZE = 256;
46 static char buffer[MAX_SIZE];
50 strftime(buffer, MAX_SIZE,
"%X", localtime(&ts));
104 operator std::string()
const
117 const std::string buffer = ctime(&
ts);
121 return buffer.substr(0, buffer.length() - 1);
154 void set(
const time_t t1)
const
169 return difftime(this->
ts,
object.
ts);
182 return out <<
object.toString();
void set() const
Set to actual time.
const tm * operator->() const
Smart pointer.
friend std::ostream & operator<<(std::ostream &out, const JDateAndTime &object)
Write date and time to output.
std::string toString() const
Get ASCII formatted date and time.
int getSeconds() const
seconds after the minute [0-59]
double getTime(const Hit &hit)
Get true time of hit.
const JDateAndTime & operator()() const
Set date and time.
JDateAndTime()
Default constructor.
static JDateAndTime getDateAndTime
Function object to get ASCII formatted date and time.
int getMonth() const
month of the year [1-12]
int getDay() const
day of the month [1-31]
double getElapsedTime(const JDateAndTime &object) const
Get elapsed time since given date and time.
const char * getDate()
Get ASCII formatted date.
void set(const time_t t1) const
Set to given time.
Auxililary class to get date and time.
int getHour() const
hours after midnight [0-23]
int getMinutes() const
minutes after the hour [0-59]
int getYear() const
year a.d.
JDateAndTime(const time_t t1)
Constructor.