#include <cctime.h>
Inheritance diagram for CCTimeBase:
Public Member Functions | |
CCTimeBase () | |
CCTimeBase constructor, doesn't do much for the moment. | |
virtual | ~CCTimeBase () |
Destructor for a CCTimeBase object. | |
virtual INT32 | GetDay () |
returns the Day of the month, ranges between 1 and 31 | |
virtual INT32 | GetDayOfWeek () |
return the day of the week, 1=Sunday, 2=Monday etc | |
virtual INT32 | GetMonth () |
Returns the month based on local time, in the range 1 through 12, (1=January). | |
virtual INT32 | GetYear () |
Returns the year based on local time, in the range 1970 through 2038,. | |
virtual INT32 | GetHour () |
returns the hour, based on local time, in the range 0 through 23 | |
virtual INT32 | Get12Hour () |
virtual INT32 | Get24Hour () |
virtual INT32 | GetMinute () |
Returns the minute based on local time, in the range 0 through 59. | |
virtual INT32 | GetSecond () |
Returns the second based on local time, in the range 0 through 59,. | |
virtual void | GetCurrentTime () |
virtual void | ConvertStandardDateAndTime (const String_64 *pFormat, String_256 *pOutput) |
Build a date and time string using the format string provided. Allowable format fields are yr = year mt = month dy = day hr = hours (24 hour clock) mn = minutes sc = seconds th = hours (12 hour clock) pm = am/pm characters %% = % These fields should be embedded in the format string along with other characters eg "%hr/%mn/%sc" = 19/22/33 "%dy/%mt/%yr" = 21/12/1996 "%dy/%mt/%yr - %hr/%mn/%sc" = 21/12/1996 - 19/22/33" "%dy/%mt/%yr - %th.%mn %pm" = 21/12/1996 - 6.45 am. | |
const CCTimeBase & | operator= (const CCTimeBase &timeSrc) |
Assign one CCTimeBase object to another. | |
Protected Member Functions | |
cctime * | GetTimeStruct () |
Return a pointer to our internal time structure for derived classes to use. They should really use the access functions for all but the initialisation of this structure. | |
Private Attributes | |
cctime | TheTime |
Definition at line 131 of file cctime.h.
|
CCTimeBase constructor, doesn't do much for the moment.
Definition at line 125 of file cctime.cpp. 00126 { 00127 TheTime.tm_sec = 0; // seconds after the minute - [0,59] 00128 TheTime.tm_min = 0; // minutes after the hour - [0,59] 00129 TheTime.tm_hour = 0; // hours since midnight - [0,23] 00130 TheTime.tm_mday = 0; // day of the month - [1,31] 00131 TheTime.tm_mon = 0; // months since January - [0,11] 00132 TheTime.tm_year = 0; // years since 1900 00133 TheTime.tm_wday = 0; // days since Sunday - [0,6] 00134 TheTime.tm_yday = 0; // days since January 1 - [0,365] 00135 TheTime.tm_isdst = 0; // daylight savings time flag 00136 }
|
|
Destructor for a CCTimeBase object.
Definition at line 149 of file cctime.cpp.
|
|
Build a date and time string using the format string provided. Allowable format fields are yr = year mt = month dy = day hr = hours (24 hour clock) mn = minutes sc = seconds th = hours (12 hour clock) pm = am/pm characters %% = % These fields should be embedded in the format string along with other characters eg "%hr/%mn/%sc" = 19/22/33 "%dy/%mt/%yr" = 21/12/1996 "%dy/%mt/%yr - %hr/%mn/%sc" = 21/12/1996 - 19/22/33" "%dy/%mt/%yr - %th.%mn %pm" = 21/12/1996 - 6.45 am.
Definition at line 344 of file cctime.cpp. 00345 { 00346 if (pFormat==NULL || pOutput==NULL) 00347 return; 00348 00349 String_64 Format = (*pFormat); 00350 00351 const TCHAR percent = TEXT('%'); 00352 00353 // find the number of characters in this string 00354 INT32 ilen = Format.Length(); 00355 INT32 ipos = 0; 00356 String_32 tempstr; 00357 INT32 num,az; 00358 TCHAR ch0,ch1,ch2; 00359 00360 while (ipos<ilen) 00361 { 00362 ch0 = Format[ipos]; 00363 if (ch0==percent) 00364 { 00365 if ((ipos+2) < ilen) 00366 { 00367 ch1 = Format[ipos+1]; 00368 ch2 = Format[ipos+2]; 00369 00370 if (ch1==percent) 00371 { 00372 (*pOutput) += ch1; 00373 ipos+=1; 00374 } 00375 else 00376 { 00377 if (ch1==TEXT('p') && ch2==TEXT('m')) 00378 { 00379 (*pOutput) += ((GetHour()>12) ? TEXT("pm") : TEXT("am")); 00380 ipos+=2; 00381 } 00382 else 00383 { 00384 num = -1; 00385 az = 0; 00386 00387 if (ch1==TEXT('y') && ch2==TEXT('r')) { num = (INT32)GetYear() % 100; 00388 az=1; } 00389 else if (ch1==TEXT('m') && ch2==TEXT('t')) { num = (INT32)GetMonth(); az=0; } 00390 else if (ch1==TEXT('d') && ch2==TEXT('y')) { num = (INT32)GetDay(); az=0; } 00391 else if (ch1==TEXT('h') && ch2==TEXT('r')) { num = (INT32)GetHour(); az=1; } 00392 else if (ch1==TEXT('m') && ch2==TEXT('n')) { num = (INT32)GetMinute();az=1; } 00393 else if (ch1==TEXT('s') && ch2==TEXT('c')) { num = (INT32)GetSecond();az=1; } 00394 else if (ch1==TEXT('t') && ch2==TEXT('h')) { num = (INT32)Get12Hour();az=0; } 00395 00396 if (num>-1) 00397 { 00398 Convert::LongToString(num, &tempstr); 00399 if (az==1 && num<10) 00400 (*pOutput)+=TEXT('0'); 00401 (*pOutput) += tempstr; 00402 ipos+=2; 00403 } 00404 } 00405 } 00406 } 00407 else 00408 (*pOutput) += ch0; 00409 } 00410 else 00411 (*pOutput) += ch0; 00412 00413 ipos++; 00414 } 00415 }
|
|
Definition at line 219 of file cctime.cpp. 00220 { 00221 INT32 t = GetHour(); 00222 if (t>12) t-=12; 00223 if (t==0) t+=12; // adjust for midnight 0 time 00224 return t; 00225 }
|
|
Definition at line 227 of file cctime.cpp. 00228 { 00229 return GetHour(); 00230 }
|
|
Reimplemented in CCTime, and CCGmtTime. Definition at line 149 of file cctime.h.
|
|
returns the Day of the month, ranges between 1 and 31
Definition at line 182 of file cctime.cpp.
|
|
return the day of the week, 1=Sunday, 2=Monday etc
Definition at line 198 of file cctime.cpp.
|
|
returns the hour, based on local time, in the range 0 through 23
Definition at line 214 of file cctime.cpp.
|
|
Returns the minute based on local time, in the range 0 through 59.
Definition at line 243 of file cctime.cpp.
|
|
Returns the month based on local time, in the range 1 through 12, (1=January).
Reimplemented in CCTime, and CCGmtTime. Definition at line 259 of file cctime.cpp.
|
|
Returns the second based on local time, in the range 0 through 59,.
Definition at line 275 of file cctime.cpp.
|
|
Return a pointer to our internal time structure for derived classes to use. They should really use the access functions for all but the initialisation of this structure.
Definition at line 165 of file cctime.cpp. 00166 { 00167 return &TheTime; 00168 }
|
|
Returns the year based on local time, in the range 1970 through 2038,.
Reimplemented in CCGmtTime. Definition at line 291 of file cctime.cpp.
|
|
Assign one CCTimeBase object to another.
Definition at line 307 of file cctime.cpp.
|
|
|