5 #include <libutl/Duration.h> 182 set(year, month, day, hour,
min, sec, isGMT);
203 operator time_t()
const 216 void getComponents(
uint_t* year,
222 double* sec =
nullptr,
223 bool* isDST =
nullptr,
224 bool isGMT =
false)
const;
230 return (getYear() == 1970);
244 struct tm* tmP = localtime(&_dateTime);
252 struct tm* tmP = localtime(&_dateTime);
260 struct tm* tmP = localtime(&_dateTime);
268 struct tm* tmP = localtime(&_dateTime);
276 struct tm* tmP = localtime(&_dateTime);
284 struct tm* tmP = localtime(&_dateTime);
292 struct tm* tmP = localtime(&_dateTime);
302 getComponents(
nullptr,
nullptr,
nullptr,
nullptr, &h, &m, &s);
303 return (h * 3600) + (m * 60) + s;
313 _dateTime = dateTime;
357 String toGMTstring()
const;
420 res._dateTime += (time_t)rhs.
get();
428 res._dateTime -= (time_t)rhs.
get();
444 _dateTime += (time_t)rhs.
get();
451 _dateTime -= (time_t)rhs.
get();
477 static const char* abbrevWeekDayName[7];
479 static const char* weekDayName[7];
481 static const char* abbrevMonthName[12];
483 static const char* monthName[12];
499 static int secondsFromGMT;
String toString(const FwdIt &begin, const FwdIt &end, const String &sep, bool key=false)
Obtain a string representation of a sequence (via Object::toString()).
void serialize(bool &b, Stream &stream, uint_t io, uint_t mode=ser_default)
Serialize a boolean.
T roundDown(const T &v, const T &m)
Round the given value v down to the nearest multiple of m.
Time(time_t t)
Constructor.
uint_t getMin() const
Get the minute [0,59].
void deInit()
De-initialize UTL++.
bool isNull() const
Get the Null flag.
default representation (via getSerializeMode())
Time & operator=(time_t t)
Assignment from time_t.
#define UTL_CLASS_DECL(DC, BC)
Declaration of standard UTL++ functionality for a non-template class.
uint_t getDayOfWeek() const
Get the day of week [0 = Sunday, .
uint_t getTimeOfDay() const
Get the number of seconds since midnight.
Time(const String &fmt, const String &str)
Constructor.
uint_t getDay() const
Get the day.
const Time & operator+=(const Duration &rhs)
Add the given duration to self.
uint_t getMonth() const
Get the month.
#define UTL_CLASS_SERIALIZE(className)
Implement serialize() for a class.
static Time current()
Return the current time.
void copy(T *dest, const T *src, size_t len)
Copy one array of objects to another.
Time operator+(const Duration &rhs) const
Return self plus the given duration.
Time operator+(int i) const
Return self plus the given number of seconds.
uint_t getYear() const
Get the year.
unsigned int uint_t
Unsigned integer.
Time operator-(const Duration &rhs) const
Return self minus the given duration.
Time & setCurrent()
Set to the current time.
T get() const
Get the value.
const T & min(const T &a, const T &b, const R &... args)
Return the smallest value among two or more provided values of the same type.
Time(uint_t year, uint_t month=1, uint_t day=1, uint_t hour=0, uint_t min=0, double sec=0, bool isGMT=false)
Constructor.
uint_t getHour() const
Get the hour [0,23].
Root of UTL++ class hierarchy.
int compare(bool lhs, bool rhs)
Compare two boolean values.
const Time & operator-=(const Duration &rhs)
Subtract the given duration from self.
T roundUp(const T &v, const T &m)
Round the given value v up to the nearest multiple of m.
Time operator-(int i) const
Return self minus the given number of seconds.
void init()
Initialize UTL++.
void setNull()
Set to null.
uint_t getSec() const
Get the second [0,59].