// Clock.cpp : Implementation of CClock
#include "stdafx.h"
#include "PNCOMDemo.h"
#include "Clock.h"

/////////////////////////////////////////////////////////////////////////////
// CClock


STDMETHODIMP CClock::get_Time(BSTR *pVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	CTime Now = CTime::GetCurrentTime();
	CString Ret;
	
	if( m_AMPM )
		Ret = Now.Format( "%I:%M:%S %p" );
	else
		Ret = Now.Format( "%H:%M:%S" );

	*pVal = Ret.AllocSysString();

	return S_OK;
}

STDMETHODIMP CClock::get_AMPM(BOOL *pVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	*pVal = m_AMPM;

	return S_OK;
}

STDMETHODIMP CClock::put_AMPM(BOOL newVal)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState())

	// TODO: Add your implementation code here
	m_AMPM = newVal;

	return S_OK;
}
