CString CXTPPropertyGridItemDate::Format(const COleDateTime& oleDate)
{
	if (oleDate.GetStatus() != COleDateTime::valid)
		return _T("");

#if _MSC_VER > 1310
	if (oleDate.GetYear() <= 1900) // Visual Studio 2005 bug.
	{
		CString strDate;
		if (m_strFormat == _T("%d/%m/%Y"))
		{
			strDate.Format(_T("%.2i/%.2i/%.4i"), oleDate.GetDay(), oleDate.GetMonth(), oleDate.GetYear());
			return strDate;
		}
		if (m_strFormat == _T("%m/%d/%Y"))
		{
			strDate.Format(_T("%.2i/%.2i/%.4i"), oleDate.GetMonth(), oleDate.GetDay(), oleDate.GetYear());
			return strDate;
		}
	}
#endif
	if (m_strFormat.IsEmpty())
		return oleDate.Format();

	return oleDate.Format(m_strFormat);
}
Beispiel #2
0
bool CSmartCache::GetUrlCacheInfo(LPCTSTR pstrURL)
{
	DWORD dwEntrySize = sizeof(INTERNET_CACHE_ENTRY_INFO);
	INTERNET_CACHE_ENTRY_INFO* pCacheEntryInfo = NULL;
	if (!(pCacheEntryInfo = AllocateCacheEntry(pCacheEntryInfo, dwEntrySize)))
		return false;

	bool bDone = false;
	while (!bDone && !GetUrlCacheEntryInfoEx(pstrURL, pCacheEntryInfo, &dwEntrySize, NULL, NULL, NULL, NULL))
	{
		if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
		{
			if (!(pCacheEntryInfo = AllocateCacheEntry(pCacheEntryInfo, dwEntrySize)))
				bDone = true;
		}
		else
			bDone = true;
	}

	bool bSuccess = !bDone;
	if (bSuccess)
	{
		COleDateTime SyncTime = pCacheEntryInfo->LastSyncTime;
		CString strSyncDate;
		strSyncDate.Format("%d/%d/%d", SyncTime.GetMonth(), SyncTime.GetDay(), SyncTime.GetYear());
		COleDateTime AccessTime = pCacheEntryInfo->LastAccessTime;
		CString strAccessDate;
		strAccessDate.Format("%d/%d/%d", AccessTime.GetMonth(), AccessTime.GetDay(), AccessTime.GetYear());
	}
	
	delete [] pCacheEntryInfo;
	
	return bSuccess;
}
BOOL CXTPDatePickerItemDay::IsToday(COleDateTime &dt)
{
	BOOL bReturn = FALSE;
	COleDateTime dtToday;
	if (m_pControl->GetToday(dtToday))
	{
		if (dt.GetMonth() == dtToday.GetMonth() &&
			dt.GetYear() == dtToday.GetYear() &&
			dt.GetDay() == dtToday.GetDay())
			bReturn = TRUE;
	}

	return bReturn;
}
Beispiel #4
0
// ///////////////////////////////////////////////////////////////////////////
//
COleDateTime Time2AdjustedDate( const CString& sTime, const COleDateTime& startDate )
{
	int hr,min;
	String2HourMin(sTime, hr, min);

	// If the given time is before the startDate's time, then the target date is one day further
	//
	if ((hr < startDate.GetHour()) || ((hr == startDate.GetHour()) && (min < startDate.GetMinute())))
	{
		COleDateTime dt = startDate + COleDateTimeSpan(1,0,0,0);
		return COleDateTime(dt.GetYear(), dt.GetMonth(), dt.GetDay(), hr, min, 0);
	}

	return COleDateTime(startDate.GetYear(), startDate.GetMonth(), startDate.GetDay(), hr, min, 0);
}
Beispiel #5
0
// ///////////////////////////////////////////////////////////////////////////
// Build a new date object  by copying the given date object and replacing
// its time by the given one
//
COleDateTime SetTimeOfDate( const COleDateTime& date, const CString& sTime )
{
	int hr,min;
	String2HourMin(sTime, hr, min);

	return COleDateTime(date.GetYear(), date.GetMonth(), date.GetDay(), hr, min, 0);
}
Beispiel #6
0
CDBField& CDBField::operator =( const LPCTSTR szVal )
{
	switch( m_dwType ) {
	case	DBVT_NULL:
			//	Undefined data type
			ASSERT( FALSE );

	case	DBVT_BOOL:
			m_boolVal = (szVal != NULL || atoi( szVal ) != 0 );
			return	*this;

	case	DBVT_UCHAR:
			m_chVal = (unsigned char)szVal[0];
			return	*this;

	case	DBVT_SHORT:
			m_iVal = (short)atoi( szVal );
			return	*this;

	case	DBVT_LONG:
			m_lVal = (long)atol( szVal );
			return	*this;

	case	DBVT_SINGLE:
			m_fltVal = (float)atof( szVal );
			return	*this;

	case	DBVT_DOUBLE:
			m_dblVal = (double)atof( szVal );
			return	*this;

	case	DBVT_DATE:
		{
			ASSERT( m_pdate != NULL );
			COleDateTime	dt;
			dt.ParseDateTime( szVal );
			m_pdate->year	= dt.GetYear();
			m_pdate->month	= dt.GetMonth();
			m_pdate->day	= dt.GetDay();
			m_pdate->hour	= dt.GetHour();
			m_pdate->minute	= dt.GetMinute();
			m_pdate->second = dt.GetSecond();
			m_pdate->fraction = 0;
			return	*this;
		}

	case	DBVT_STRING:
			ASSERT( m_pstring != NULL );
			*m_pstring = szVal;
			return	*this;

	case	DBVT_BINARY:
			//	CRecordset does not support writing to CLongBinary fields
			ASSERT( FALSE );
			return	*this;
	}
	//	Undefined data type
	ASSERT( FALSE );
	return	*this;
}
Beispiel #7
0
NET_TIME CDevByFileDlg::ConvertToDateTime(const COleDateTime &date, const CTime &time)
{
	NET_TIME netTime = {0};
	int year = date.GetYear();
	if (year < 2000)
	{
		netTime.dwYear = 2000;
		netTime.dwMonth = 1;
		netTime.dwDay = 1;
		netTime.dwHour = 0;
		netTime.dwMinute = 0;
		netTime.dwSecond = 0;
	}
	else
	{
		netTime.dwYear = date.GetYear();
		netTime.dwMonth = date.GetMonth();
		netTime.dwDay = date.GetDay();
		netTime.dwHour = time.GetHour();
		netTime.dwMinute = time.GetMinute();
		netTime.dwSecond =time.GetSecond();
	}
	
	return netTime;
}
Beispiel #8
0
bool CHpAutoUpdate::IsSilentUpdateAllowed()
{
	CRegKey regkey;
	if (regkey.Open(REGKEY_APPROOT, REGKEY_HPAPP) != ERROR_SUCCESS)
		return true;
	
	DWORD dwSize = MAX_PATH;
	TCHAR szBuffer[MAX_PATH];
	if (regkey.QueryStringValue(REGVAL_AUTOUPDATE, szBuffer, &dwSize) != ERROR_SUCCESS)
		return true;

	COleDateTime Date;
	bool bOK = Date.ParseDateTime(CString(szBuffer), 0/*dwFlags*/);
	if (!bOK)
		return true;

	COleDateTime Now = COleDateTime::GetCurrentTime();
	CString strDate;
	strDate.Format("%d/%d/%d", Now.GetMonth(), Now.GetDay(), Now.GetYear());
	bOK = Now.ParseDateTime(CString(strDate), 0/*dwFlags*/);
	if (!bOK)
		return true;

	return (Date != Now);
}
void CBCGPRecurrenceRuleMonthly::CorrectStart ()
{
	COleDateTime dt (GetDateStart ());

	int m = dt.GetMonth ();
	int y = dt.GetYear ();

	int d = GetPossibleDay (m, y);

	if (d < dt.GetDay ())
	{
		m++;

		if (m == 13)
		{
			m = 1;
			y++;
		}

		d = GetPossibleDay (m, y);
	}

	int nDays = CBCGPCalendar::GetMaxMonthDay (m, y);

	dt = COleDateTime (y, m, nDays < d ? nDays : d, 0, 0, 0);

	if (dt != GetDateStart ())
	{
		SetDateStart (dt);
	}
}
// Start the server. This blocks until the server stops.
void AgentConfigurationEx::start()
{
	GLogger.LogMessage(StdStringFormat("AgentConfigurationEx::start()\n"));
	getAgent()->set_listening_port(Globals.HttpPort);
	MTConnectService::setName(Globals.ServerName);

	for(int i=0; i< _ipaddrs.size(); i++)
	{
		COpcAdapter *  _cmdHandler = new COpcAdapter(this, config, _ipaddrs[i], _devices[i], _tags[i]);
		_cncHandlers.push_back(_cmdHandler);
		GLogger.LogMessage(StdStringFormat("AgentConfigurationEx::start COpcAdapter::Cycle() %x\n",_ipaddrs[i]), DBUG);
		_group.create_thread(boost::bind(&COpcAdapter::Cycle, _cncHandlers[i]));
	}
	GLogger.LogMessage(StdStringFormat("Call AgentConfiguration::start() ed \n"));

	if(Globals.ResetAtMidnight)
	{
		COleDateTime now = COleDateTime::GetCurrentTime();
		COleDateTime date2 =  COleDateTime(now.GetYear(), now.GetMonth(), now.GetDay(), 0, 0, 0) +  COleDateTimeSpan(1, 0, 0, 1);
		//COleDateTime date2 =  now +  COleDateTimeSpan(0, 0, 2, 0); // testing reset time - 2 minutes
		COleDateTimeSpan tilmidnight = date2-now;
		_resetthread.Initialize();
		_resetthread.AddTimer(
			(long) tilmidnight.GetTotalSeconds() * 1000,
			&_ResetThread,
			(DWORD_PTR) this,
			&_ResetThread._hTimer  // stored newly created timer handle
			) ;

		GLogger.LogMessage(StdStringFormat("Agent will Reset At Midnight %s \n", (LPCSTR) date2.Format()), DBUG);
	}

	AgentConfiguration::start(); // does not return
}
// NOTE: Windows SCM more tolerant of slow starting processes than terminating processes.
void MtcOpcAdapter::start()
{
 	static char name[] = "MtcOpcAdapter::start";
	_bRunning=true; 
	if(_bResetAtMidnight)
	{
		COleDateTime now = COleDateTime::GetCurrentTime();
		COleDateTime date2 =  COleDateTime(now.GetYear(), now.GetMonth(), now.GetDay(), 0, 0, 0) +  COleDateTimeSpan(1, 0, 0, 1);
		//COleDateTime date2 =  now +  COleDateTimeSpan(0, 0, 2, 0); // testing reset time - 2 minutes

		COleDateTimeSpan tilmidnight = date2-now;
		_resetthread.Initialize();
		_resetthread.AddTimer(
			(long) tilmidnight.GetTotalSeconds() * 1000,
			&_ResetThread,
			(DWORD_PTR) this,
			&_ResetThread._hTimer  // stored newly created timer handle
			) ;

		GLogger << INFO << "Adapter will Reset At Midnight " << date2.Format() << std::endl;
	}

	if(_bOPCEnabled)
	{
		_workerthread.Initialize();
		::SetEvent (_StartThread._hEvent); // start OPC thread
		_workerthread.AddHandle(_StartThread._hEvent, &_StartThread,(DWORD_PTR) this);
	}

	// This goes last... never returns
	startServer();
}
Beispiel #12
0
bool Cx_CfgRecord::GetDateTime(const wchar_t* pszEntry, int& year, int& month, int& day, 
                                  int& hour, int& minute, int& second)
{
    ASSERT_MESSAGE(m_pRs != NULL, "The record is write-only.");

    if (m_pRs != NULL)
    {
        try
        {
            _variant_t var(m_pRs->GetFields()->GetItem(pszEntry)->GetValue());
            COleDateTime dt;

            if (DbFunc::GetDateTime(dt, var))
            {
                year = dt.GetYear();
                month = dt.GetMonth();
                day = dt.GetDay();
                hour = dt.GetHour();
                minute = dt.GetMinute();
                second = dt.GetSecond();

                return true;
            }
        }
        CATCH_DB_STR_ERROR
    }

    return false;
}
void CCalendarDlg2::SetTextForDay(SYSTEMTIME* sysTime)
{
    static BOOL bFirst=1;
    static CString sDovesok;
    static COleDateTime dtCurrent;
    if(!bFirst && dtCurrent.GetStatus()!=COleDateTime::invalid) {
        CString sThisDayNKey=Format(sKey,dtCurrent.GetDay(),dtCurrent.GetMonth(),dtCurrent.GetYear());
        CString sCurDay;
        m_eText.GetWindowText(sCurDay);
        sCurDay.TrimLeft();
        sCurDay.TrimRight();
        if(sCurDay!="") {
            sCurDay.Replace("\r\n","\n");
            if(sDovesok!="") {
                sCurDay+=Format("[?CDATA{%s}?DATAC:)]",sDovesok);
            }
            if(!bINewLine) {
                sCurDay.Replace("\n","<br>");
            }
            CString sContent=CString("\n")+sCurDay+"\n";
            while(sContent!="") {
                CString sLine=sContent.SpanExcluding("\n");
                if(sLine!="") {
                    aItems.Add(sThisDayNKey+sLine);
                    if(sContent.GetLength()>sLine.GetLength()) {
                        sContent=sContent.Mid(sLine.GetLength()+1);
                    } else {
                        sContent="";
                    }
                }
                sContent.TrimLeft();
            }
        }
        sDovesok="";
    }
    bFirst=0;
    if(sysTime) {
        COleDateTime dtTime=COleDateTime(sysTime->wYear,sysTime->wMonth,sysTime->wDay,0,0,0);
        char szTmp[256]= {0};
        GetDateFormat(LOCALE_USER_DEFAULT,DATE_SHORTDATE,sysTime,0,szTmp,sizeof(szTmp));
        GetDlgItem(IDC_STATIC3)->SetWindowText(Format("%s: %s",_l("Current date"),szTmp));
        CString sThisDayNKey=Format(sKey,dtTime.GetDay(),dtTime.GetMonth(),dtTime.GetYear());
        dtCurrent=dtTime;
        CString sDayNote;
        for(int i=aItems.GetSize()-1; i>=0; i--) {
            if(aItems[i].Find(sThisDayNKey)==0) {
                if(sDayNote!="") {
                    sDayNote+="\r\n";
                }
                sDayNote+=aItems[i].Mid(sThisDayNKey.GetLength());
                aItems.RemoveAt(i);
            }
        }
        sDovesok=CDataXMLSaver::GetInstringPart("[?CDATA{","}?DATAC:)]",sDayNote);
        sDayNote.Replace(Format("[?CDATA{%s}?DATAC:)]",sDovesok),"");
        sDayNote.Replace("<br>","\r\n");
        m_eText.SetWindowText(sDayNote);
    }
}
Beispiel #14
0
BOOL CGuiParameter::GetFormatDate(CString& m_szDate, CString Format)
{
	COleDateTime time;
	if (!GetValue(time)) return FALSE;
	CTime ct(time.GetYear(),time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond()); 
	m_szDate =ct.Format(Format);
	return TRUE;
}
Beispiel #15
0
BOOL CGuiRecordSet::GetFormatDate(int nIndex,CString& m_szDate, CString Format)
{
	COleDateTime time;
	if (!GetCollect(nIndex,time)) return FALSE;
	CTime ct(time.GetYear(),time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond()); 
	m_szDate =ct.Format(Format);
	return TRUE;
}
void CDlgUserManager::OnNMClickListUser(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
	// TODO: 在此添加控件通知处理程序代码
	*pResult = 0;
	if (-1 == pNMItemActivate->iItem) return;

	CString strTem;
	COleDateTime ot;

	strTem = m_listUser.GetItemText(pNMItemActivate->iItem,1);
	m_strEditUserName = strTem;

	strTem = m_listUser.GetItemText(pNMItemActivate->iItem,2);
	m_strEditPwd = strTem;

	strTem = m_listUser.GetItemText(pNMItemActivate->iItem,3);
	ot.ParseDateTime(strTem);
	CTime ti0(ot.GetYear(),ot.GetMonth(),ot.GetDay(),ot.GetHour(),ot.GetMinute(),ot.GetMinute());
	m_regTime.SetTime(&ti0);

	strTem = m_listUser.GetItemText(pNMItemActivate->iItem,4);
	
	ot.ParseDateTime(strTem);
	CTime ti(ot.GetYear(),ot.GetMonth(),ot.GetDay(),ot.GetHour(),ot.GetMinute(),ot.GetMinute());
	m_expireDate.SetTime(&ti);

	strTem = m_listUser.GetItemText(pNMItemActivate->iItem,5);
	m_strEditCompany = strTem;

	strTem = m_listUser.GetItemText(pNMItemActivate->iItem,6);

	for (int i=0;i<sizeof(g_szPowerArray)/sizeof(g_szPowerArray[0]);i++)
	{
		if ( !_tcsicmp(strTem,CString(g_szPowerArray[i]) ) )
		{
			m_comPower.SetCurSel(i);
			break;
		}
	}

	

	UpdateData(FALSE);
}
Beispiel #17
0
void Date::SetValue(const COleDateTime& codt)
{
	Year(codt.GetYear());
	Month(codt.GetMonth());
	Day(codt.GetDay());
	Hour(codt.GetHour());
	Min(codt.GetMinute());
	Sec(codt.GetSecond());
}
void CBCGPPlannerViewWorkWeek::SetDate (const COleDateTime& date)
{
	COleDateTime dt (date.GetYear (), date.GetMonth (), date.GetDay (), 0, 0, 0);

	m_DateStart = CalculateDateStart (dt);
	m_DateEnd   = m_DateStart + COleDateTimeSpan (GetWorkWeekInterval () - 1, 23, 59, 59);

	CBCGPPlannerView::SetDate (dt);
}
void COCalendar::CallDialogOnDate(COleDateTime dtTmp)
{
	SYSTEMTIME st;
	st.wYear=dtTmp.GetYear();
	st.wMonth=dtTmp.GetMonth();
	st.wDay=dtTmp.GetDay();
	char szFG[64]="";
	char szBG[64]="";
	DWORD dwColor=m_WMCtrl.GetItemColor();
	sprintf(szFG,"#%02X%02X%02X",GetRValue(dwColor),GetGValue(dwColor),GetBValue(dwColor));
	dwColor=m_WMCtrl.GetBkColor();
	sprintf(szBG,"#%02X%02X%02X",GetRValue(dwColor),GetGValue(dwColor),GetBValue(dwColor));
	if(pCallback->CallEditDayNote(st,szFG,szBG)==0){
		COleDateTime dt=COleDateTime::GetCurrentTime();
		dt.SetDateTime(dtTmp.GetYear(),dtTmp.GetMonth(),dtTmp.GetDay(),dt.GetHour(),dt.GetMinute(),dt.GetSecond());
		CreateNewReminder(dt,pCallback,this);
	}
};
Beispiel #20
0
zOPER_EXPORT void OPERATION
SetZeidonDateFromOleDateTime( zPCHAR pchDate, COleDateTime& DateTime )
{
   // pchDate looks like this:  YYYYMMDDhhmmssttt
   zsprintf( pchDate, "%04d%02d%02d%02d%02d%02d%03d",
             DateTime.GetYear( ), DateTime.GetMonth( ),
             DateTime.GetDay( ), DateTime.GetHour( ),
             DateTime.GetMinute( ), DateTime.GetSecond( ), 0 );
}
Beispiel #21
0
COleDateTime CChartAxis::AddMonthToDate(const COleDateTime& Date, int iMonthsToAdd)
{
	COleDateTime newDate;
	int nMonths = Date.GetMonth()-1 + iMonthsToAdd;
	int nYear = Date.GetYear() + nMonths/12;

	newDate.SetDateTime(nYear,nMonths%12+1,Date.GetDay(),Date.GetHour(),
		Date.GetMinute(),Date.GetSecond());
	return newDate;
}
Beispiel #22
0
void CFieldDate::FormatForOutput(COleDateTime od, CString& rs)
{
	rs.Format(DateTimeFormat,
	od.GetYear(),
	od.GetMonth(),
	od.GetDay(),
	od.GetHour(),
	od.GetMinute(),
	od.GetSecond());
}
Beispiel #23
0
void CFieldDate::XConvert3(LPCTSTR pSomeVal, int& y, int& m, int& d)
{
	COleDateTime temp = ConvertX(pSomeVal);
	if (temp.GetStatus() == COleDateTime::valid)
	{
		d = temp.GetDay();
		m = temp.GetMonth();
		y = temp.GetYear();
	}
}
Beispiel #24
0
void CDateRemind::SetDateTime(CString date)
{
	COleVariant VariantTime;
	VariantTime = date;
	VariantTime.ChangeType(VT_DATE);
	COleDateTime DateTime = VariantTime;

	m_nYear = DateTime.GetYear();
	m_nMonth = DateTime.GetMonth();
	m_nDay = DateTime.GetDay();
}
void COCalendar::CallContextOnDate(COleDateTime dtTmp)
{
	SYSTEMTIME st;
	st.wYear=dtTmp.GetYear();
	st.wMonth=dtTmp.GetMonth();
	st.wDay=dtTmp.GetDay();
	int iRes=pCallback->CallContextDayNote(st,GetSafeHwnd());
	if(iRes==-1){
		CreateNewReminder(dtTmp,pCallback,this);
	}
};
void  CMy2DGaitRecognitionDlg::gr_write_log(CString &strLogMsg)
{
	//获取当前系统时间
	COleDateTime time = COleDateTime::GetCurrentTime();
	CString strTime;
	strTime.Format(_T("%d-%d-%d %d:%d:%d"), time.GetYear(),
		time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond());
	CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT_LOG);
	pEdit->SetSel(pEdit->GetWindowTextLength(), -1);
	pEdit->ReplaceSel(strTime + _T(" ") + strLogMsg + _T("\r\n"));
}
Beispiel #27
0
void CEx08aView::OnLButtonDown(UINT nFlags, CPoint point) 
{
	CActiveXDialog dlg;
	dlg.m_BackColor = RGB(255, 251, 240); // light yellow
	COleDateTime today = COleDateTime::GetCurrentTime();
	dlg.m_varValue = COleDateTime(today.GetYear(), today.GetMonth(),
	                              today.GetDay(), 0, 0, 0);
	if (dlg.DoModal() == IDOK) {
		COleDateTime date(dlg.m_varValue);
		AfxMessageBox(date.Format("%B %d, %Y"));
	}
}
Beispiel #28
0
//
//	[static protected] ODBCGridCtrl::GetDate_FieldAsText
//
void		
ODBCGridCtrl::GetDate_FieldAsText(ODBCGridCol* pDBCol, CString& sFieldText, CRecord* pRec)
	{
	static COleDateTime dtTime;
	if( pRec->IsFieldNull(pDBCol->nFieldID) )
		sFieldText = _T("");
	else
		{
		pRec->GetDate(pDBCol->nFieldID, dtTime);
		sFieldText.Format("%02d/%02d/%04d", dtTime.GetDay(), dtTime.GetMonth(), dtTime.GetYear());
		}
	}
//*******************************************************************************
void CBCGPDateTimeCtrl::ClosePopupCalendar (COleDateTime date/* = COleDateTime ()*/)
{
	if (m_pPopup == NULL)
	{
		return;
	}

	ASSERT_VALID (m_pPopup);
	ASSERT(::IsWindow (m_pPopup->GetSafeHwnd ()));

	BOOL bIsDateChanged = FALSE;

	if (date != COleDateTime ())
	{
		COleDateTime dateOld = GetDate ();

		if (dateOld.GetDay () != date.GetDay () ||
			dateOld.GetMonth () != date.GetMonth () ||
			dateOld.GetYear () != date.GetYear ())
		{
			bIsDateChanged = TRUE;
		}

		SetDate (date);
	}

	m_pPopup->SendMessage (WM_CLOSE);

	if (::IsWindow (GetSafeHwnd ()))
	{
		m_pPopup = NULL;
		SetFocus ();

		if (bIsDateChanged)
		{
			OnDateChanged ();
		}
	}
}
Beispiel #30
0
time_t CDateTime::getTimeT(COleDateTime &tmptime) {
	sTm->tm_year = tmptime.GetYear() - 1900;
	sTm->tm_mon = tmptime.GetMonth() > 0? tmptime.GetMonth() - 1: 0;
	sTm->tm_mday = tmptime.GetDay();
	sTm->tm_hour = tmptime.GetHour();
	sTm->tm_min = tmptime.GetMinute();
	sTm->tm_sec = tmptime.GetSecond();
	sTm->tm_wday = tmptime.GetDayOfWeek();
	sTm->tm_yday = tmptime.GetDayOfYear();
	sTm->tm_isdst = 0;
	
	time_t sStamp =  mktime(sTm);
	return sStamp;
}