39 #ifndef BLOCXX_DATETIME_HPP_INCLUDE_GUARD_
40 #define BLOCXX_DATETIME_HPP_INCLUDE_GUARD_
41 #include "blocxx/BLOCXX_config.h"
51 namespace BLOCXX_NAMESPACE
178 explicit DateTime(
const String& str);
189 explicit DateTime(time_t t, UInt32 microseconds=0);
212 UInt32 microsecond=0,
213 ETimeOffset timeOffset = E_LOCAL_TIME);
224 int getHour(ETimeOffset timeOffset = E_LOCAL_TIME)
const;
231 int getMinute(ETimeOffset timeOffset = E_LOCAL_TIME)
const;
239 int getSecond(ETimeOffset timeOffset = E_LOCAL_TIME)
const;
247 UInt32 getMicrosecond()
const;
254 int getDay(ETimeOffset timeOffset = E_LOCAL_TIME)
const;
260 int getDow(ETimeOffset timeOffset = E_LOCAL_TIME)
const;
265 int getMonth(ETimeOffset timeOffset = E_LOCAL_TIME)
const;
270 int getYear(ETimeOffset timeOffset = E_LOCAL_TIME)
const;
282 void setHour(
int hour, ETimeOffset timeOffset = E_LOCAL_TIME);
290 void setMinute(
int minute, ETimeOffset timeOffset = E_LOCAL_TIME);
298 void setSecond(
int second, ETimeOffset timeOffset = E_LOCAL_TIME);
305 void setMicrosecond(UInt32 microsecond);
319 ETimeOffset timeOffset = E_LOCAL_TIME);
327 void setDay(
int day, ETimeOffset timeOffset = E_LOCAL_TIME);
336 void setMonth(
int month, ETimeOffset timeOffset = E_LOCAL_TIME);
345 void setYear(
int year, ETimeOffset timeOffset = E_LOCAL_TIME);
355 void set(time_t t, UInt32 microseconds=0);
379 ETimeOffset timeOffset = E_LOCAL_TIME);
390 void addDays(
int days);
397 void addWeeks(
int weeks)
407 void addMonths(
int months);
414 void addYears(
int years);
421 void addSeconds(
long seconds)
429 void addMinutes(
long minutes)
431 m_time += minutes * 60;
437 void addMicroseconds(
long microseconds)
439 m_microseconds += microseconds;
440 m_time += m_microseconds / 1000000;
441 m_microseconds %= 1000000;
447 void addMilliseconds(
long milliseconds)
449 this->addMicroseconds(milliseconds * 1000);
455 void addHours(
long hours) { m_time += hours * 60 * 60; }
467 return m_time < tm.
m_time;
495 return !(*
this == tm);
505 return !(tm < *
this);
515 return !(*
this < tm);
522 DateTime& operator+= (
long seconds)
532 DateTime& operator-= (
long seconds)
534 addSeconds(-seconds);
543 String toString(ETimeOffset timeOffset = E_LOCAL_TIME)
const;
556 char const * format, ETimeOffset timeOffset = E_LOCAL_TIME)
const;
563 static char const DEFAULT_FORMAT[];
578 static Int16 getGMTOffset();
588 static Int16 getGMTOffsetMinutesNow()
601 Int16 toLocal(
struct tm & tt)
const
609 static DateTime getCurrent();
616 static Int16 localTimeAndOffset(time_t t,
struct tm & tt);
624 BLOCXX_COMMON_API DateTime
operator-(DateTime
const & x, DateTime
const & y);