CCGmtTime Class Reference

Creates a time object which can be interogated about the current time. If you create a static version of this object you will most likely need to use the GetCurrentTime() function on the object from time to time, otherwise it will inevitable become out of date as time and tide waits for no man. This is not a class to use to time funtions and such. Its accuracy is to the nearest second only. This version returns Greenwich Mean Time rather than Local time. More...

#include <cctime.h>

Inheritance diagram for CCGmtTime:

CCTimeBase CCObject SimpleCCObject List of all members.

Public Member Functions

 CCGmtTime ()
 Costructor for CCGmtTime....
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 void GetCurrentTime ()
 Updates this CCGMTTime object with the date and time now.

Detailed Description

Creates a time object which can be interogated about the current time. If you create a static version of this object you will most likely need to use the GetCurrentTime() function on the object from time to time, otherwise it will inevitable become out of date as time and tide waits for no man. This is not a class to use to time funtions and such. Its accuracy is to the nearest second only. This version returns Greenwich Mean Time rather than Local time.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/08/96
See also:
: CCTime

Definition at line 211 of file cctime.h.


Constructor & Destructor Documentation

CCGmtTime::CCGmtTime  ) 
 

Costructor for CCGmtTime....

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/08/96

Definition at line 513 of file cctime.cpp.

00514 {
00515     // Force the time to be up-to-the-second
00516     GetCurrentTime();
00517 }


Member Function Documentation

void CCGmtTime::GetCurrentTime  )  [virtual]
 

Updates this CCGMTTime object with the date and time now.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/08/96

Reimplemented from CCTimeBase.

Definition at line 530 of file cctime.cpp.

00531 {
00532     time_t osBinaryTime;
00533     time(&osBinaryTime);
00534     struct tm *p_tm;
00535 
00536     cctime *p_time = GetTimeStruct();
00537 #ifdef __WXMSW__
00538     CTime t(osBinaryTime);
00539     p_tm = t.GetGmtTm(NULL);
00540 #else
00541     p_tm=gmtime( &osBinaryTime ); // Convert to local time.
00542 #endif
00543 
00544     p_time->tm_sec  = p_tm->tm_sec;
00545     p_time->tm_min  = p_tm->tm_min;
00546     p_time->tm_hour = p_tm->tm_hour; 
00547     p_time->tm_mday = p_tm->tm_mday; 
00548     p_time->tm_mon  = p_tm->tm_mon;
00549     p_time->tm_year = p_tm->tm_year;
00550     p_time->tm_wday = p_tm->tm_wday; 
00551     p_time->tm_yday = p_tm->tm_yday; 
00552     p_time->tm_isdst= p_tm->tm_isdst;
00553 }

INT32 CCGmtTime::GetMonth  )  [virtual]
 

Returns the month based on local time, in the range 1 through 12, (1=January).

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/08/96

Reimplemented from CCTimeBase.

Definition at line 556 of file cctime.cpp.

00557 {
00558     return CCTimeBase::GetMonth() + 1;
00559 }

INT32 CCGmtTime::GetYear  )  [virtual]
 

Returns the year based on local time, in the range 1970 through 2038,.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/08/96

Reimplemented from CCTimeBase.

Definition at line 561 of file cctime.cpp.

00562 {
00563     return CCTimeBase::GetYear() + 1900;
00564 }


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:52:05 2007 for Camelot by  doxygen 1.4.4