39#include "blocxx/BLOCXX_config.h"
49#ifdef BLOCXX_HAVE_SYS_TIME_H
56#ifndef BLOCXX_HAVE_LOCALTIME_R
64 struct tm *p = localtime(timep);
75#ifndef BLOCXX_HAVE_GMTIME_R
80struct tm *
gmtime_r(
const time_t *timep,
struct tm *result)
83 struct tm *p = gmtime(timep);
94#ifndef BLOCXX_HAVE_ASCTIME_R
102 char *p = asctime(tm);
107 ::strncpy(result,p,25);
165 else if (
str[1] ==
'a')
177 else if (
str[0] ==
'M')
191 else if (
str[0] ==
'T')
200 else if (
str[1] ==
'h')
212 else if (
str[0] ==
'W')
226 else if (
str[0] ==
'F')
250 if ( (s ==
"Sunday") ||
253 (s ==
"Wednesday") ||
276 else if (
str[1] ==
'u')
282 else if (
str[2] ==
'l')
288 else if (
str[0] ==
'F')
290 if (
str[1] ==
'e' &&
str[2] ==
'b')
295 else if (
str[0] ==
'M')
303 else if (
str[2] ==
'y')
309 else if (
str[0] ==
'A')
318 else if (
str[1] ==
'u')
326 else if (
str[0] ==
'S')
328 if (
str[1] ==
'e' &&
str[2] ==
'p')
333 else if (
str[0] ==
'O')
335 if (
str[1] ==
'c' &&
str[2] ==
't')
340 else if (
str[0] ==
'N')
342 if (
str[1] ==
'o' &&
str[2] ==
'v')
347 else if (
str[0] ==
'D')
349 if (
str[1] ==
'e' &&
str[2] ==
'c')
361 if (
str.equals(
"January") )
365 else if (
str.equals(
"February") )
369 else if (
str.equals(
"March") )
373 else if (
str.equals(
"April") )
377 else if (
str.equals(
"May") )
381 else if (
str.equals(
"June") )
385 else if (
str.equals(
"July") )
389 else if (
str.equals(
"August") )
393 else if (
str.equals(
"September") )
397 else if (
str.equals(
"October") )
401 else if (
str.equals(
"November") )
405 else if (
str.equals(
"December") )
655 { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
666 if ( (
year % 4) == 0 )
669 if ( (
year % 100) == 0 )
671 if ( (
year % 400) == 0 )
746 if (
str.length() == 25 )
749 if ( !(
str[14] !=
'.' || (
str[21] !=
'+' &&
str[21] !=
'-')) )
1008#ifdef BLOCXX_HAVE_TIMEGM
1014#ifdef BLOCXX_NETWARE
1190 tmarg.tm_isdst = -1;
1199#ifdef BLOCXX_HAVE_GETTIMEOFDAY
1262 size_t const BUFSZ = 1024;
1265 buf[
n >= BUFSZ ? 0 :
n] =
'\0';
char * asctime_r(const struct tm *tm, char *result)
struct tm * gmtime_r(const time_t *timep, struct tm *result)
struct tm * localtime_r(const time_t *timep, struct tm *result)
#define BLOCXX_DEFINE_EXCEPTION_WITH_ID(NAME)
Define a new exception class named <NAME>Exception that derives from Exception.
#define BLOCXX_THROW(exType, msg)
Throw an exception using FILE and LINE.
V::const_iterator const_iterator
The DateTime class is an abstraction for date time data.
ETimeOffset
The values of this enum are passed to various functions to as a flag to indicate the timezone context...
static char const DEFAULT_FORMAT[]
A default date/time format to use with toString().
void setSecond(int second, ETimeOffset timeOffset=E_LOCAL_TIME)
Set the second component of this DateTime object.
DateTime()
Create a new DateTime object that represents the Epoch (00:00:00 UTC, January 1, 1970)
void addMonths(int months)
Add months to the date represented by this object.
int getHour(ETimeOffset timeOffset=E_LOCAL_TIME) const
Get the hour of the day for this DateTime object 0-23.
UInt32 getMicrosecond() const
Get the microsecond of the second for this DateTime object.
bool operator==(const DateTime &tm) const
Equality operator.
void addYears(int years)
Add years to the date represent by this object.
String toStringGMT() const BLOCXX_DEPRECATED
This is the same as toString(E_UTC_TIME).
void setMicrosecond(UInt32 microsecond)
Set the microsecond component of this DateTime object.
int getMinute(ETimeOffset timeOffset=E_LOCAL_TIME) const
Get the minute of the hour for this DateTime object 0-59.
void setHour(int hour, ETimeOffset timeOffset=E_LOCAL_TIME)
Set the hour component of this DateTime object.
void setMonth(int month, ETimeOffset timeOffset=E_LOCAL_TIME)
Set the month component of this DateTime object.
void setTime(int hour, int minute, int second, ETimeOffset timeOffset=E_LOCAL_TIME)
Set the time component of this DateTime object.
static Int16 localTimeAndOffset(time_t t, struct tm &tt)
int getSecond(ETimeOffset timeOffset=E_LOCAL_TIME) const
Get the second of the minute for this DateTime object normally in the range 0-59, but can be up to 60...
void setDay(int day, ETimeOffset timeOffset=E_LOCAL_TIME)
Set the day component of this DateTime object.
void setMinute(int minute, ETimeOffset timeOffset=E_LOCAL_TIME)
Set the minute component of this DateTime object.
int getDow(ETimeOffset timeOffset=E_LOCAL_TIME) const
String toString(ETimeOffset timeOffset=E_LOCAL_TIME) const
int getMonth(ETimeOffset timeOffset=E_LOCAL_TIME) const
void setToCurrent()
Set this DateTime to the current system time.
void setYear(int year, ETimeOffset timeOffset=E_LOCAL_TIME)
Set the year component of this DateTime object.
int getYear(ETimeOffset timeOffset=E_LOCAL_TIME) const
void addDays(int days)
Add days to the date represented by this object.
tm getTm(ETimeOffset timeOffset) const
static DateTime getCurrent()
Gets a DateTime instance set to the current system time.
void set(time_t t, UInt32 microseconds=0)
Set this DateTime object with a time_t value.
int getDay(ETimeOffset timeOffset=E_LOCAL_TIME) const
Get the day of the month (1-31)
This String class is an abstract data type that represents as NULL terminated string of characters.
Char16 operator-(const Char16 &arg1, const Char16 &arg2)
bool operator==(const Array< T > &x, const Array< T > &y)