1 #ifndef __JSYSTEM__JDATE__
2 #define __JSYSTEM__JDATE__
16 namespace JPP {
using namespace JSYSTEM; }
38 static const int MAX_SIZE = 256;
39 static char buffer[MAX_SIZE];
46 strftime(buffer, MAX_SIZE,
"%x", localtime(&ts));
50 strftime(buffer, MAX_SIZE,
"%F", localtime(&ts));
70 static const int MAX_SIZE = 256;
71 static char buffer[MAX_SIZE];
78 strftime(buffer, MAX_SIZE,
"%X %Z", localtime(&ts));
82 strftime(buffer, MAX_SIZE,
"%T%z", localtime(&ts));
151 operator std::string()
const
169 static const int MAX_SIZE = 256;
170 static char buffer[MAX_SIZE];
175 strftime(buffer, MAX_SIZE,
"%FT%T%z",
tp);
179 strftime(buffer, MAX_SIZE,
"%a %b %d %X %Z %Y",
tp);
188 buffer[MAX_SIZE-1] =
'\0';
190 return string(buffer);
223 void set(
const time_t t1)
const
238 return difftime(this->
ts,
object.
ts);
251 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.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
JDateAndTimeFormat
Date and time formats.
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.
std::string toString(const JDateAndTimeFormat option=HUMAN_READABLE) const
Get ASCII formatted date and time.
Human readable format (Www Mmm dd hh:mm:ss yyyy)
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.
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]
Exception for accessing a value in a collection that is outside of its range.
int getYear() const
year a.d.
tm * operator->()
Smart pointer.
const char * getDate(const JDateAndTimeFormat option=HUMAN_READABLE)
Get ASCII formatted date.
JDateAndTime(const time_t t1)
Constructor.