|
|
|
@@ -29,6 +29,7 @@
|
|
|
|
# include <time.h>
|
|
|
|
# include <time.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DOXYGEN
|
|
|
|
#ifdef DOXYGEN
|
|
|
|
//! \brief Sleep for "msecs" milliseconds
|
|
|
|
//! \brief Sleep for "msecs" milliseconds
|
|
|
|
void msleep(int msecs);
|
|
|
|
void msleep(int msecs);
|
|
|
|
@@ -56,6 +57,9 @@ inline void piMSleep(double msecs) {piUSleep(int(msecs * 1000.));} // on !Window
|
|
|
|
* \details This function exec \a piUSleep (msecs * 1000000). */
|
|
|
|
* \details This function exec \a piUSleep (msecs * 1000000). */
|
|
|
|
inline void piSleep(double secs) {piUSleep(int(secs * 1000000.));} // on !Windows consider constant "usleep" offset
|
|
|
|
inline void piSleep(double secs) {piUSleep(int(secs * 1000000.));} // on !Windows consider constant "usleep" offset
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PIP_EXPORT PISystemTime {
|
|
|
|
class PIP_EXPORT PISystemTime {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
|
|
@@ -176,7 +180,7 @@ private:
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//! \relatesalso PICout \relatesalso PIByteArray \brief Output operator to PICout
|
|
|
|
//! \relatesalso PICout \relatesalso PICout \brief Output operator to PICout
|
|
|
|
inline PICout operator <<(PICout s, const PISystemTime & v) {s.space(); s.setControl(0, true); s << "(" << v.seconds << " s, " << v.nanoseconds << " ns)"; s.restoreControl(); return s;}
|
|
|
|
inline PICout operator <<(PICout s, const PISystemTime & v) {s.space(); s.setControl(0, true); s << "(" << v.seconds << " s, " << v.nanoseconds << " ns)"; s.restoreControl(); return s;}
|
|
|
|
|
|
|
|
|
|
|
|
//! \relatesalso PISystemTime \relatesalso PIByteArray \brief Output operator to PIByteArray
|
|
|
|
//! \relatesalso PISystemTime \relatesalso PIByteArray \brief Output operator to PIByteArray
|
|
|
|
@@ -185,6 +189,9 @@ inline PIByteArray & operator <<(PIByteArray & s, const PISystemTime & v) {s <<
|
|
|
|
//! \relatesalso PISystemTime \relatesalso PIByteArray \brief Input operator from PIByteArray
|
|
|
|
//! \relatesalso PISystemTime \relatesalso PIByteArray \brief Input operator from PIByteArray
|
|
|
|
inline PIByteArray & operator >>(PIByteArray & s, PISystemTime & v) {s >> v.seconds >> v.nanoseconds; return s;}
|
|
|
|
inline PIByteArray & operator >>(PIByteArray & s, PISystemTime & v) {s >> v.seconds >> v.nanoseconds; return s;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct PIP_EXPORT PITime {
|
|
|
|
struct PIP_EXPORT PITime {
|
|
|
|
PITime(int hours_ = 0, int minutes_ = 0, int seconds_ = 0, int milliseconds_ = 0): hours(hours_), minutes(minutes_), seconds(seconds_), milliseconds(milliseconds_) {;}
|
|
|
|
PITime(int hours_ = 0, int minutes_ = 0, int seconds_ = 0, int milliseconds_ = 0): hours(hours_), minutes(minutes_), seconds(seconds_), milliseconds(milliseconds_) {;}
|
|
|
|
int hours;
|
|
|
|
int hours;
|
|
|
|
@@ -196,6 +203,7 @@ struct PIP_EXPORT PITime {
|
|
|
|
static PITime current();
|
|
|
|
static PITime current();
|
|
|
|
static PITime fromSystemTime(const PISystemTime & st);
|
|
|
|
static PITime fromSystemTime(const PISystemTime & st);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
PIP_EXPORT bool operator ==(const PITime & t0, const PITime & t1);
|
|
|
|
PIP_EXPORT bool operator ==(const PITime & t0, const PITime & t1);
|
|
|
|
PIP_EXPORT bool operator <(const PITime & t0, const PITime & t1);
|
|
|
|
PIP_EXPORT bool operator <(const PITime & t0, const PITime & t1);
|
|
|
|
PIP_EXPORT bool operator >(const PITime & t0, const PITime & t1);
|
|
|
|
PIP_EXPORT bool operator >(const PITime & t0, const PITime & t1);
|
|
|
|
@@ -205,6 +213,12 @@ inline bool operator >=(const PITime & t0, const PITime & t1) {return !(t0 < t1)
|
|
|
|
inline PIByteArray & operator <<(PIByteArray & s, const PITime & v) {s << v.hours << v.minutes << v.seconds << v.milliseconds; return s;}
|
|
|
|
inline PIByteArray & operator <<(PIByteArray & s, const PITime & v) {s << v.hours << v.minutes << v.seconds << v.milliseconds; return s;}
|
|
|
|
inline PIByteArray & operator >>(PIByteArray & s, PITime & v) {s >> v.hours >> v.minutes >> v.seconds >> v.milliseconds; return s;}
|
|
|
|
inline PIByteArray & operator >>(PIByteArray & s, PITime & v) {s >> v.hours >> v.minutes >> v.seconds >> v.milliseconds; return s;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! \relatesalso PICout \relatesalso PICout \brief Output operator to PICout
|
|
|
|
|
|
|
|
PICout operator <<(PICout s, const PITime & v);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct PIP_EXPORT PIDate {
|
|
|
|
struct PIP_EXPORT PIDate {
|
|
|
|
PIDate(int year_ = 0, int month_ = 0, int day_ = 0): year(year_), month(month_), day(day_) {;}
|
|
|
|
PIDate(int year_ = 0, int month_ = 0, int day_ = 0): year(year_), month(month_), day(day_) {;}
|
|
|
|
int year;
|
|
|
|
int year;
|
|
|
|
@@ -213,6 +227,7 @@ struct PIP_EXPORT PIDate {
|
|
|
|
PIString toString(const PIString & format = "d.MM.yyyy") const;
|
|
|
|
PIString toString(const PIString & format = "d.MM.yyyy") const;
|
|
|
|
static PIDate current();
|
|
|
|
static PIDate current();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
PIP_EXPORT bool operator ==(const PIDate & t0, const PIDate & t1);
|
|
|
|
PIP_EXPORT bool operator ==(const PIDate & t0, const PIDate & t1);
|
|
|
|
PIP_EXPORT bool operator <(const PIDate & t0, const PIDate & t1);
|
|
|
|
PIP_EXPORT bool operator <(const PIDate & t0, const PIDate & t1);
|
|
|
|
PIP_EXPORT bool operator >(const PIDate & t0, const PIDate & t1);
|
|
|
|
PIP_EXPORT bool operator >(const PIDate & t0, const PIDate & t1);
|
|
|
|
@@ -222,6 +237,12 @@ inline bool operator >=(const PIDate & t0, const PIDate & t1) {return !(t0 < t1)
|
|
|
|
inline PIByteArray & operator <<(PIByteArray & s, const PIDate & v) {s << v.year << v.month << v.day; return s;}
|
|
|
|
inline PIByteArray & operator <<(PIByteArray & s, const PIDate & v) {s << v.year << v.month << v.day; return s;}
|
|
|
|
inline PIByteArray & operator >>(PIByteArray & s, PIDate & v) {s >> v.year >> v.month >> v.day; return s;}
|
|
|
|
inline PIByteArray & operator >>(PIByteArray & s, PIDate & v) {s >> v.year >> v.month >> v.day; return s;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! \relatesalso PICout \relatesalso PICout \brief Output operator to PICout
|
|
|
|
|
|
|
|
PICout operator <<(PICout s, const PIDate & v);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct PIP_EXPORT PIDateTime {
|
|
|
|
struct PIP_EXPORT PIDateTime {
|
|
|
|
PIDateTime() {year = month = day = hours = minutes = seconds = milliseconds = 0;}
|
|
|
|
PIDateTime() {year = month = day = hours = minutes = seconds = milliseconds = 0;}
|
|
|
|
PIDateTime(const PITime & time) {year = month = day = 0; hours = time.hours; minutes = time.minutes; seconds = time.seconds; milliseconds = time.milliseconds;}
|
|
|
|
PIDateTime(const PITime & time) {year = month = day = 0; hours = time.hours; minutes = time.minutes; seconds = time.seconds; milliseconds = time.milliseconds;}
|
|
|
|
@@ -255,6 +276,7 @@ struct PIP_EXPORT PIDateTime {
|
|
|
|
static PIDateTime fromSystemTime(const PISystemTime & st) {PIDateTime dt = fromSecondSinceEpoch(st.seconds); dt.milliseconds = piClampi(st.nanoseconds / 1000000, 0, 999); return dt;}
|
|
|
|
static PIDateTime fromSystemTime(const PISystemTime & st) {PIDateTime dt = fromSecondSinceEpoch(st.seconds); dt.milliseconds = piClampi(st.nanoseconds / 1000000, 0, 999); return dt;}
|
|
|
|
static PIDateTime current();
|
|
|
|
static PIDateTime current();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
inline PIDateTime operator +(const PIDateTime & d0, const PIDateTime & d1) {PIDateTime td = d0; td += d1; return td.normalized();}
|
|
|
|
inline PIDateTime operator +(const PIDateTime & d0, const PIDateTime & d1) {PIDateTime td = d0; td += d1; return td.normalized();}
|
|
|
|
inline PIDateTime operator -(const PIDateTime & d0, const PIDateTime & d1) {PIDateTime td = d0; td -= d1; return td.normalized();}
|
|
|
|
inline PIDateTime operator -(const PIDateTime & d0, const PIDateTime & d1) {PIDateTime td = d0; td -= d1; return td.normalized();}
|
|
|
|
PIP_EXPORT bool operator ==(const PIDateTime & t0, const PIDateTime & t1);
|
|
|
|
PIP_EXPORT bool operator ==(const PIDateTime & t0, const PIDateTime & t1);
|
|
|
|
@@ -266,6 +288,12 @@ inline bool operator >=(const PIDateTime & t0, const PIDateTime & t1) {return !(
|
|
|
|
inline PIByteArray & operator <<(PIByteArray & s, const PIDateTime & v) {s << v.year << v.month << v.day << v.hours << v.minutes << v.seconds << v.milliseconds; return s;}
|
|
|
|
inline PIByteArray & operator <<(PIByteArray & s, const PIDateTime & v) {s << v.year << v.month << v.day << v.hours << v.minutes << v.seconds << v.milliseconds; return s;}
|
|
|
|
inline PIByteArray & operator >>(PIByteArray & s, PIDateTime & v) {s >> v.year >> v.month >> v.day >> v.hours >> v.minutes >> v.seconds >> v.milliseconds; return s;}
|
|
|
|
inline PIByteArray & operator >>(PIByteArray & s, PIDateTime & v) {s >> v.year >> v.month >> v.day >> v.hours >> v.minutes >> v.seconds >> v.milliseconds; return s;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! \relatesalso PICout \relatesalso PICout \brief Output operator to PICout
|
|
|
|
|
|
|
|
PICout operator <<(PICout s, const PIDateTime & v);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DEPRECATED inline PITime currentTime() {return PITime::current();} // obsolete, use PITime::current() instead
|
|
|
|
DEPRECATED inline PITime currentTime() {return PITime::current();} // obsolete, use PITime::current() instead
|
|
|
|
DEPRECATED inline PIDate currentDate() {return PIDate::current();} // obsolete, use PIDate::current() instead
|
|
|
|
DEPRECATED inline PIDate currentDate() {return PIDate::current();} // obsolete, use PIDate::current() instead
|
|
|
|
DEPRECATED inline PIDateTime currentDateTime() {return PIDateTime::current();} // obsolete, use PIDateTime::current() instead
|
|
|
|
DEPRECATED inline PIDateTime currentDateTime() {return PIDateTime::current();} // obsolete, use PIDateTime::current() instead
|
|
|
|
|