CCTime 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 local time. More...

#include <cctime.h>

Inheritance diagram for CCTime:

CCTimeBase CCObject SimpleCCObject List of all members.

Public Member Functions

 CCTime ()
 Constructor for CCTime object. We get the current local time ready for use.
virtual void GetCurrentTime ()
 Updates this CCTime object with the date and time now.
virtual INT32 GetMonth ()
 Returns the month based on local time, in the range 1 through 12, (1=January).

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 local time.

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

Definition at line 180 of file cctime.h.


Constructor & Destructor Documentation

CCTime::CCTime  ) 
 

Constructor for CCTime object. We get the current local time ready for use.

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

Definition at line 439 of file cctime.cpp.

00440 {
00441     // Force the time to be up-to-the-second
00442     GetCurrentTime();
00443 }


Member Function Documentation

void CCTime::GetCurrentTime  )  [virtual]
 

Updates this CCTime 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 455 of file cctime.cpp.

00456 {
00457     struct tm *newtime;
00458     time_t long_time;
00459 
00460     // Set time zone from TZ environment variable. If TZ is not set,
00461     // operating system default is used, otherwise PST8PDT is used
00462     // (Pacific standard time, daylight savings).
00463 //    _tzset();
00464 
00465     time( &long_time );                // Get time as long integer.
00466     newtime = localtime( &long_time ); // Convert to local time.
00467 
00468     cctime *p_time = GetTimeStruct();
00469 
00470     p_time->tm_sec  = newtime->tm_sec;
00471     p_time->tm_min  = newtime->tm_min;
00472     p_time->tm_hour = newtime->tm_hour; 
00473     p_time->tm_mday = newtime->tm_mday; 
00474     p_time->tm_mon  = newtime->tm_mon;
00475     p_time->tm_year = newtime->tm_year;
00476     p_time->tm_wday = newtime->tm_wday; 
00477     p_time->tm_yday = newtime->tm_yday; 
00478     p_time->tm_isdst= newtime->tm_isdst;
00479 }

INT32 CCTime::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 491 of file cctime.cpp.

00492 {
00493     return CCTimeBase::GetMonth() + 1;
00494 }


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