Write the time as per the supplied format. Pointer to buffer populated with the time in text form. Note: The space required is allocated from the thread scratch pad and must not be deleted by the calling function.
| Return Type | Function name | Arguments |
|---|---|---|
| const char* | hzTime::Txt | (hzDateFmt,) |
Declared in file: hzDate.h
Defined in file : hzDate.cpp
Function Logic:
Function body:
const char* hzTime::Txt (hzDateFmt eFmt)
{
// Write the time as per the supplied format.
//
// Arguments: 1) eFmt Requested format of output string
//
// Returns: Pointer to buffer populated with the time in text form.
//
// Note: The space required is allocated from the thread scratch pad and must not be deleted by the calling function.
_hzfunc("hzTime::Txt") ;
char* pBuf ; // Text recepticle
pBuf = _thisfn.ScratchPad(16);
if (m_secs == NULL_TIME)
strcpy(pBuf, "Not set") ;
else
{
if (eFmt & FMT_TIME_DFLT)
sprintf(pBuf, "%02d%02d%02d", Hour(), Min(), Sec()) ;
else if (eFmt & FMT_TIME_STD)
sprintf(pBuf, "%02d:%02d:%02d", Hour(), Min(), Sec()) ;
else
strcpy(pBuf, "Invalid Time") ;
}
return pBuf ;
}