{
WORD First;
int weekofmonth = compareDate->wDay;
- First = ( 6 + compareDate->wDayOfWeek - date->wDayOfWeek + date->wDay ) % 7 + 1;
+ First = (WORD)(( 6 + compareDate->wDayOfWeek - date->wDayOfWeek + date->wDay ) % 7 + 1);
limit_day = First + 7 * (weekofmonth - 1);
if(limit_day > monthLengths[date->wMonth==2 && ISLEAP(date->wYear)][date->wMonth - 1])
limit_day -= 7;
else if( beforeStandardDate || afterDaylightDate )
retval = TIME_ZONE_ID_DAYLIGHT;
}
- else
+ else
retval = TIME_ZONE_ID_UNKNOWN;
return retval;
}
return true;
}
-static bool _TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation, LPSYSTEMTIME lpLocalTime, LPSYSTEMTIME lpUniversalTime)
+static bool _TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation, LPSYSTEMTIME lpLocalTime, LPSYSTEMTIME lpUniversalTime)
{
FILETIME ft;
LONG lBias;
public class Time : double
{
- char * OnGetString(char * tempString, void * fieldData, bool * needClass)
+ const char * OnGetString(char * tempString, void * fieldData, bool * needClass)
{
Time time = this;
int value;
value = (int)(time / (60 * 60 * 24));
if(value)
{
-
+
sprintf(temp, "%d:", value);
strcat(tempString, temp);
time -= value * 60 * 60 * 24;
public class SecSince1970 : int64
{
- char * OnGetString(char * tempString, void * fieldData, bool * needClass)
+ const char * OnGetString(char * tempString, void * fieldData, bool * needClass)
+ {
+ return ((DateTime)this).OnGetString(tempString, fieldData, needClass);
+ }
+
+ bool OnGetDataFromString(const char * string)
{
- // TOFIX: passing argument 2 of '__ecereProp___ecereNameSpace__ecere__sys__DateTime_Set___ecereNameSpace__ecere__sys__SecSince1970' makes integer from pointer without a cast
- DateTime t = this;
- return t.OnGetString(tempString, fieldData, needClass);
- // TOFIX:
- // return ((DateTime)this).OnGetString(tempString, fieldData, needClass);
+ DateTime dt { };
+ if(dt.OnGetDataFromString(string))
+ {
+ this = dt;
+ return true;
+ }
+ return false;
}
// Is this required?
public:
property SecSince1970 global
{
- // TOFIX: 'return' with a value, in function returning void
- set { return value.local; }
get
{
#if defined(__WIN32__)
SYSTEMTIME localTime, systemTime;
- FILETIME fileTime, localFileTime;
+ //FILETIME fileTime, localFileTime;
DateTime input, global;
input = this;
localTime.wYear = (short)input.year;
- localTime.wMonth = (short)input.month + 1;
+ localTime.wMonth = (short)(input.month + 1);
localTime.wDay = (short)input.day;
localTime.wHour = (short)input.hour;
localTime.wMinute = (short)input.minute;
};
property SecSince1970 local
{
- // TOFIX: warning: 'return' with a value, in function returning void
- set { return value.global; }
get
{
#if defined(__WIN32__)
utc = this;
systemTime.wYear = (short)utc.year;
- systemTime.wMonth = (short)utc.month + 1;
+ systemTime.wMonth = (short)(utc.month + 1);
systemTime.wDay = (short)utc.day;
systemTime.wHour = (short)utc.hour;
systemTime.wMinute = (short)utc.minute;
public class TimeStamp32 : uint32
{
public:
- char * OnGetString(char * tempString, void * fieldData, bool * needClass)
+ const char * OnGetString(char * tempString, void * fieldData, bool * needClass)
{
- DateTime t = (SecSince1970)(int)this;
- return t.OnGetString(tempString, fieldData, needClass);
- // TOFIX:
- // return ((DateTime)this).OnGetString(tempString, fieldData, needClass);
+ return ((DateTime)(TimeStamp)this).OnGetString(tempString, fieldData, needClass);
}
// Is this required?
FILETIME fileTime, localFileTime;
localTime.wYear = (short)year;
- localTime.wMonth = (short)month + 1;
+ localTime.wMonth = (short)(month + 1);
localTime.wDay = (short)day;
localTime.wHour = (short)hour;
localTime.wMinute = (short)minute;
#else
struct tm tm;
//time_t t = (time_t)(SecSince1970)this;
- time_t t = MakeTimeTfromDT(this);
+ time_t t = MakeTimeTfromDT(this);
gmtime_r(&t, &tm);
value.year = tm.tm_year + 1900;
value.month = (Month)tm.tm_mon;
SYSTEMTIME systemTime, localTime;
systemTime.wYear = (short)year;
- systemTime.wMonth = (short)month + 1;
+ systemTime.wMonth = (short)(month + 1);
systemTime.wDay = (short)day;
systemTime.wHour = (short)hour;
systemTime.wMinute = (short)minute;
{
int64 days, y;
int rem;
-
+
days = value / SECS_PER_DAY;
rem = (int)(value % SECS_PER_DAY);
return 0;
}
};
+ property Date
+ {
+ set
+ {
+ year = value.year;
+ month = value.month;
+ day = value.day;
+ hour = 0;
+ minute = 0;
+ second = 0;
+ }
+ get { value = Date { year, month, day }; }
+ }
- char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
+ const char * OnGetString(char * stringOutput, void * fieldData, bool * needClass)
{
static const char ampm[2][3] = { "AM", "PM" };
int hour = this.hour;
if(!year && !day && !month && !this.hour && !minute && !second)
stringOutput[0] = 0;
else
- sprintf(stringOutput, "%s %s %2d %2d:%02d:%02d %s %04d",
+ sprintf(stringOutput, "%s %s %2d %2d:%02d:%02d %s %04d",
shortDaysNames[dayOfTheWeek], shortMonthsNames[month], day, hour, minute, second, ampm[pm], year);
return stringOutput;
}
- bool OnGetDataFromString(char * string)
+ bool OnGetDataFromString(const char * string)
{
char * s = CopyString(string);
char * tokens[20];
int c;
bool foundDayOfTheWeek = false;
bool foundDate = false;
- DayOfTheWeek dayOfTheWeek;
+ DayOfTheWeek dayOfTheWeek = 0;
int day = 0;
int minute = 0;
int second = 0;
for(c = 0; c < count; c++)
{
int i;
- for(i = 0; i<7; i++)
+ for(i = 0; i<7; i++)
if(!strcmpi(tokens[c], shortDaysNames[i]) || !strcmpi(tokens[c], longDaysNames[i]) ||
!strcmpi(tokens[c], enShortDaysNames[i]) || !strcmpi(tokens[c], enLongDaysNames[i]))
- break;
+ break;
if(i < 7) { dayOfTheWeek = (DayOfTheWeek)i; foundDayOfTheWeek = true; continue; }
- for(i = 0; i<12; i++)
+ for(i = 0; i<12; i++)
if(!strcmpi(tokens[c], shortMonthsNames[i]) || !strcmpi(tokens[c], longMonthsNames[i]) ||
!strcmpi(tokens[c], enShortMonthsNames[i]) || !strcmpi(tokens[c], enLongMonthsNames[i]))
- break;
+ break;
if(i < 12) { month = (Month)i; continue; }
if(strchr(tokens[c], ':'))
else if(!strcmpi(subTokens[t], "pm")) pm = true;
else if(t-am-pm == 0) hour = atoi(subTokens[t]);
else if(t-am-pm == 1) minute = atoi(subTokens[t]);
- else if(t-am-pm == 2) second = atoi(subTokens[t]);
+ else if(t-am-pm == 2) second = atoi(subTokens[t]);
}
-
+
if(c < count - 1)
{
if(!strcmpi(tokens[c+1], "am")) am = true;
continue;
}
-
+
if(!foundDate)
{
if(strchr(tokens[c], '/') || strchr(tokens[c], '-'))