CTime::CTime

CTime( );

CTime( const CTime& timeSrc );

CTime( time_t time );

CTime( int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, int nDST = -1 );

CTime( WORD wDosDate, WORD wDosTime, int nDST = -1 );

CTime( const SYSTEMTIME& sysTime, int nDST = -1 );

CTime( const FILETIME& fileTime, int nDST = -1 );

Parameters

timeSrc

Indicates a CTime object that already exists.

time

Indicates a time value.

nYear, nMonth, nDay, nHour, nMin, nSec

Indicates the date and time values to be copied into the new CTime object.

nDST

Indicates whether daylight savings time is in effect. Can have one of three values, as follows:

wDosDate, wDosTime

MS-DOS date and time values to be converted to a date/time value and copied into the new CTime object.

sysTime

A SYSTEMTIME structure to be converted to a date/time value and copied into the new CTime object.

fileTime

A FILETIME structure to be converted to a date/time value and copied into the new CTime object.

Remarks

All these constructors create a new CTime object initialized with the specified absolute time, based on the current time zone.

Each constructor is described below:

For more information on the time_t data type, see the time function in the Run-Time Library Reference.

For more information, see the SYSTEMTIME and FILETIME structure in the Win32 SDK Programmer’s Reference.

For more information, see the MS-DOS Date and Time entry in the Win32 SDK documentation.

Example

// example for CTime::CTime
time_t osBinaryTime;  // C run-time time (defined in <time.h>)
time( &osBinaryTime ) ;  // Get the current time from the 
                         // operating system.
CTime time1; // Empty CTime. (0 is illegal time value.)
CTime time2 = time1; // Copy constructor.
CTime time3( osBinaryTime );  // CTime from C run-time time
CTime time4( 1999, 3, 19, 22, 15, 0 ); // 10:15PM March 19, 1999

CTime OverviewClass MembersHierarchy Chart

See Also   CTime::GetTime, GetCurrentTime, operator =