예제 #1
0
// Write
template<> bool OpcXml::Write(const DateTime& cValue, COpcString& cString)
{
	// check for invalid date.
	if (cValue == OpcMinDate())
	{
		cString.Empty();
		return true;
	}

	// convert to xml dateTime representation.
    SYSTEMTIME cSystemTime;
    
    if (!FileTimeToSystemTime(&((FILETIME)cValue), &cSystemTime)) 
    {
        return false;
    }

    WCHAR szBuf[MAX_VALUE_BUF_SIZE];

    swprintf(
        szBuf, 
        L"%04hu-%02hu-%02huT%02hu:%02hu:%02hu.%03hu", 
        cSystemTime.wYear,
        cSystemTime.wMonth,
        cSystemTime.wDay,
        cSystemTime.wHour,
        cSystemTime.wMinute,
        cSystemTime.wSecond,
        cSystemTime.wMilliseconds);

    cString = szBuf;
    return true;
}
예제 #2
0
// Clear
template<> void OpcXml::Clear(COpcString& cValue) 
{ 
    cValue.Empty(); 
}
예제 #3
0
// Init
template<> void OpcXml::Init(COpcString& cValue) 
{ 
    cValue.Empty(); 
}