1 #ifndef __JSYSTEM__JDATE__ 
    2 #define __JSYSTEM__JDATE__ 
   20 namespace JPP { 
using namespace JSYSTEM; }
 
   36     static const size_t     MAX_SIZE = 256;
 
   37     static char      buffer[MAX_SIZE];
 
   41     strftime(buffer, MAX_SIZE, 
"%F", localtime(&ts));
 
   55     static const size_t     MAX_SIZE = 256;
 
   56     static char      buffer[MAX_SIZE];
 
   60     strftime(buffer, MAX_SIZE, 
"%T%z",  localtime(&ts));
 
  108       const size_t pos = (buffer.find(
'Z') != string::npos ? buffer.find(
'Z') :
 
  109                           buffer.find(
'+') != string::npos ? buffer.find(
'+') : buffer.rfind(
'-'));
 
  111       if (pos == string::npos) {
 
  118       const string td = buffer.substr(0, pos);
 
  119       const char*  pd = NULL;
 
  121       switch (td.length()) {
 
  124         pd = strptime(td.c_str(), 
"%Y-%m-%d %H:%M:%S.", &tx); sscanf(pd, 
"%9ld", &
ns); pd += 9;
 
  128         pd = strptime(td.c_str(), 
"%Y-%m-%dT%H:%M:%S",  &tx);
 
  132         pd = strptime(td.c_str(), 
"%Y%m%dT%H%M%s",      &tx);
 
  136         pd = strptime(td.c_str(), 
"%Y-%m-%d",           &tx);
 
  140       if (pd == NULL || *pd != 
'\0') {
 
  146       const string tz = buffer.substr(pos + 1);
 
  147       const char*  pz = tz.c_str();
 
  152       switch (tz.length()) {
 
  158         pz = strptime(tz.c_str(), 
"%H",                 &ty);
 
  162         pz = strptime(tz.c_str(), 
"%H%M",               &ty);
 
  166         pz = strptime(tz.c_str(), 
"%H:%M",              &ty);
 
  170       if (pz == NULL || *pz != 
'\0') {
 
  176       time_t t1 = mktime(&tx);
 
  178       t1 -= (ty.tm_hour * 60 + ty.tm_min) * 60;                
 
  179       t1 += mktime(localtime(&t1)) - mktime(gmtime(&t1));      
 
  181       set(t1, buffer[pos] == 
'Z');
 
  256       catch(
const std::exception& error) {
 
  271       static const size_t     MAX_SIZE = 256;
 
  272       static char      buffer[MAX_SIZE];
 
  274       const size_t pos = strftime(buffer, MAX_SIZE, (
isUTC() ? 
"%FT%TZ" : 
"%FT%T%z"), this->
tp);
 
  276       return string(buffer, pos);
 
  314     void set(
const time_t t1, 
const bool utc = 
false)
 
  317       this->
tp  = (
utc ? gmtime(&t1) : localtime(&t1));
 
  352       return difftime(
object.
ts, this->ts);
 
  384       return out << 
object.toString();
 
void set(const time_t t1, const bool utc=false)
Set to given time. 
 
const JDateAndTime & operator()()
Set date and time. 
 
const tm * operator->() const 
Smart pointer. 
 
time_t getTime() const 
time 
 
friend std::ostream & operator<<(std::ostream &out, const JDateAndTime &object)
Write date and time to output stream. 
 
std::string toString() const 
Get ASCII formatted date and time. 
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message. 
 
JDateAndTime(const time_t t1, const bool utc=false)
Constructor. 
 
void set(const bool utc=false)
Set to current local time. 
 
int getSeconds() const 
seconds after the minute [0-59] 
 
double getTime(const Hit &hit)
Get true time of hit. 
 
void sub(const time_t t1)
Subtract given time. 
 
JDateAndTime()
Default constructor. 
 
static JDateAndTime getDateAndTime
Function object to get current date and time. 
 
bool isUTC() const 
Check if UTC time. 
 
friend std::istream & operator>>(std::istream &in, JDateAndTime &object)
Read date and time from input stream. 
 
static bool isISO8601(const std::string &buffer)
Function to check ISO-8601 conformity. 
 
JDateAndTime(const std::string &buffer)
Constructor. 
 
int getMonth() const 
month of the year [1-12] 
 
void add(const time_t t1)
Add given time. 
 
int getDay() const 
day of the month [1-31] 
 
double getElapsedTime(const JDateAndTime &object) const 
Get elapsed time to given date and time. 
 
const char * getDate()
Get current date conform ISO-8601 standard. 
 
Auxiliary class for date and time. 
 
Exception for parsing value. 
 
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 getDST() const 
daylight saving time 
 
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
 
int getYear() const 
year a.d. 
 
tm * operator->()
Smart pointer.