CTime::GetGmtTm

struct tm* GetGmtTm( struct tm* ptm = NULL ) const;

Return Value

A pointer to a filled-in struct tm as defined in the include file TIME.H. The members and the values they store are as follows:

Note   The year in struct tm is in the range 70 to 138; the year in the CTime interface is in the range January 1, 1970 to January 18, 2038 (inclusive).

Parameters

ptm

Points to a buffer that will receive the time data. If this pointer is NULL, an internal, statically allocated buffer is used. The data in this default buffer is overwritten as a result of calls to other CTime member functions.

Remarks

Gets a struct tm that contains a decomposition of the time contained in this CTime object. GetGmtTm returns UTC.

This function calls GetLocalTm, which uses an internal, statically allocated buffer. The data in this buffer is overwritten as a result of calls to other CTime member functions.

Example

// Compute difference between local time and GMT
   CTime time(CTime::GetCurrentTime());
   tm t1 = *(time.GetLocalTm());
   tm t2 = *(time.GetGmtTm());
   
   TRACE("Difference between local time and GMT is %d hours.\n", t1.tm_hour - t2.tm_hour);

CTime OverviewClass MembersHierarchy Chart