CTime::GetLocalTm

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

struct tm* GetLocalTm(
   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

GetLocalTm returns local time.

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

CTime t(1999, 3, 19, 22, 15, 0); // 10:15PM March 19, 1999
tm osTime;  // A structure containing time elements.
t.GetLocalTm(&osTime);
ATLASSERT(osTime.tm_mon == 2); // Note zero-based month!   

Requirements

Header: atltime.h

See Also

Reference

CTime Class

Hierarchy Chart

Other Resources

CTime Members