Partager via


CTime::GetGmtTm

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

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

Parameters

  • ptm
    Points to a buffer that will receive the time data. If this pointer is NULL, an exception is thrown.

Return Value

A pointer to a filled-in struct tm as defined in the include file TIME.H. See gmtime, _gmtime32, _gmtime64 for the structure layout.

Remarks

GetGmtTm returns UTC.

ptm cannot be NULL. If you want to revert to the old behavior, in which ptm could be NULL to indicate that an internal, statically allocated buffer should be used, then undefine _SECURE_ATL.

Example

// Compute difference between local time and GMT
CTime time(CTime::GetCurrentTime());
tm t1, t2;
time.GetLocalTm(&t1);
time.GetGmtTm(&t2);

ATLTRACE(_T("Difference between local time and GMT is %d hours.\n"), 
   t1.tm_hour - t2.tm_hour);   

Requirements

Header: atltime.h

See Also

Reference

CTime Class

Hierarchy Chart