Example #1
0
void CExtIdDetail::OnKillfocusEndDateEdit() 
{
	UpdateData(TRUE);
	int valid = ABP_FAILURE;

	valid = validate_date( m_eEndDate, "End Date" ); 

	// check to see if from time < to time
	if( valid == ABP_SUCCESS )
	{
		COleDateTime	CheckStartTime;
		COleDateTime	CheckEndTime;
		CString			sStartDate;
		CString			sEndDate;

		m_eStartDate.GetWindowText(sStartDate);
		m_eEndDate.GetWindowText(sEndDate);

		if( !sStartDate.IsEmpty() && !sEndDate.IsEmpty() )
		{
			// parse the date string.....
			CheckStartTime.ParseDateTime( sStartDate, VAR_DATEVALUEONLY, LANG_USER_DEFAULT );
			CheckEndTime.ParseDateTime( sEndDate, VAR_DATEVALUEONLY, LANG_USER_DEFAULT );

			if( CheckStartTime > CheckEndTime )
			{
				Beep( 400, 100 );
				CGuiMsg::GuiMessage( GUIMSG_END_DATE_AFTER_START_DATE );
				m_eEndDate.SetWindowText("");
				UpdateData(FALSE);
			}
		}
	}

}
Example #2
0
void CMiniCalendarCtrl::SetFirstDayOfWeek(int _iDayOfWeek)
{
	if (_iDayOfWeek > 0 && _iDayOfWeek <= 7)
	{
		m_iFirstDayOfWeek = _iDayOfWeek;

		COleDateTime dtTemp;
		CCalendarUtils::GetToday(dtTemp);

		// find the specified day of the week
		while (dtTemp.GetDayOfWeek() != _iDayOfWeek)
		{
			dtTemp += 1;
		}

		for (int iX = 0; iX < 7; iX++)
		{
			CString strName = CCalendarUtils::GetWeekday(iX, 1);

			//if (!Misc::IsMultibyteString(strName))
			{
				//not multibyte - only want first character of this string
				strName = strName.Left(1);
			}

			m_arrShortDayOfWeekNames[iX] = strName;
			dtTemp += 1;
		}
	}
	else
	{
		ASSERT(FALSE);
	}
}
/******************************************************************************
* ++
* Method name : CServerLogView::OnBnClickedFindButton()
* Description : Function load data need to find to listview button
* Parameters : NULL
        
* Return values : NULL
*		
* --
*****************************************************************************/
void CServerLogView::OnBnClickedFindButton()
{
	// TODO: Add your control notification handler code here
	cb_Day.GetWindowText(m_lpszDay);
	cb_Month.GetWindowText(m_lpszMonth);
	cb_Year.GetWindowText(m_lpszYear);

	if(m_lpszYear.GetLength() == 0 || m_lpszMonth.GetLength() == 0 || m_lpszDay.GetLength() == 0)
	{
		AfxMessageBox("Please choose DateTime");
		this->listctrl.DeleteAllItems();
	}
	else
	{
		int nYear	= atoi(m_lpszYear);
		int nMonth	= atoi(m_lpszMonth);
		int nDay	= atoi(m_lpszDay);

		COleDateTime cDateTime;
		cDateTime.SetDateTime(nYear, nMonth, nDay, 0, 0, 0);

		if(!cDateTime.m_status)
		{
			this->InsertLogFiletoListView(this->m_listlog->GetListLogbyDate(nYear, nMonth, nDay));
		}
		else
		{
			AfxMessageBox("DateTime is invalid");
		}
	}

}
Example #4
0
bool Cx_CfgRecord::GetDate(const wchar_t* pszEntry, int& year, int& month, int& day)
{
    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::GetDate(dt, var))
            {
                year = dt.GetYear();
                month = dt.GetMonth();
                day = dt.GetDay();

                return true;
            }
        }
        CATCH_DB_STR_ERROR
    }

    return false;
}
void CXTPPropertyGridItemDate::SetValue(CString strValue)
{
	COleDateTime dt;
	TRY
	{
		if (ParseDateTime(dt, strValue))
		{
			SetDate(dt);
		}
		else if (dt.ParseDateTime(strValue, VAR_DATEVALUEONLY))
		{
			SetDate(dt);
		}
		else if (!m_strNullValue.IsEmpty())
		{
			COleDateTime dtNull;
			dtNull.SetStatus(COleDateTime::null);

			SetDate(dtNull);
		}
	}
	CATCH(COleException, e)
	{

	}
	END_CATCH
}
void CNDTermConsumeView::InitData()
{
	if (m_cboTermID.GetCount() > 0)
	{
		return;
	}

	COleDateTime dtTmp;

	if (theApp.GetCurCashier()->IsOnDuty())
	{
		dtTmp.ParseDateTime(theApp.GetCurCashier()->GetOnDutyTime());
	}
	else
	{
		dtTmp = COleDateTime::GetCurrentTime();
		dtTmp -= COleDateTimeSpan(1, 0, 0, 0);
	}

	m_StartTime.SetDate(dtTmp);

	dtTmp = COleDateTime::GetCurrentTime();
	dtTmp += COleDateTimeSpan(1, 0, 1, 0);
	m_EndTime.SetDate(dtTmp);

	for (INT i = 0; i < CLocalServer::GetInstance()->ComputerList.GetCount(); i++)
	{
		m_cboTermID.AddString(CLocalServer::GetInstance()->ComputerList.GetComputer(i).GetTerminalID());
	}
}
//****************************************************************************************
void CBCGPDateTimeCtrl::BuidWidestDate (CDC* pDC)
{
	ASSERT_VALID (pDC);

	CBCGPDefaultLocale dl;

	//-----------------------
	// Find the widest month:
	//-----------------------
	int iMaxMonth = 1;

	if (m_monthFormat == 2)	// Numeric
	{
		iMaxMonth = 9;
	}
	else
	{
		int iMaxMonthWidth = 0;
		for (int iMonth = 1; iMonth <= 12; iMonth ++)
		{
			COleDateTime date (1998, iMonth, 1, 0, 0, 0);
			CString strMonth = date.Format (m_monthFormat == 0 ? _T ("%b") : _T("%B"));

			int iMonthWidth = pDC->GetTextExtent (strMonth).cx;
			if (iMonthWidth > iMaxMonthWidth)
			{
				iMaxMonthWidth = iMonthWidth;
				iMaxMonth = iMonth;
			}
		}
	}

	m_WidestDate = COleDateTime (2000, iMaxMonth, 20, 0, 0, 0);
}
Example #8
0
BOOL CNDCheckInDlg::CheckTakeUp(CString strTermId)
{
	//查询该终端是否被占用
	BOOL bTakeUp = FALSE;

	CLastUserInfo LastUserInfo;

	if (CIBADAL::GetInstance()->GetLastUserInfo(LastUserInfo, 0, strTermId))
	{
		if (LastUserInfo.GetSuspend())//挂机
		{
			bTakeUp = TRUE;
		}
		else//非挂机
		{
			COleDateTime updateTime;
			updateTime.ParseDateTime(LastUserInfo.GetUpdateTime());
			COleDateTimeSpan interval = COleDateTime::GetCurrentTime() - updateTime;
			
			if (interval.GetTotalMinutes() < 10)//被占用,并且用户还有效
			{
				bTakeUp = TRUE;
			} 
		}
	}

	return bTakeUp;
}
Example #9
0
CString FormatDateTime ( COleDateTime &DateTime, LPCTSTR pFormat )
{
	// If null, return empty string
	if ( DateTime.GetStatus() == COleDateTime::null || DateTime.GetStatus() == COleDateTime::invalid )
		return _T("");

	UDATE ud;
	if (S_OK != VarUdateFromDate(DateTime.m_dt, 0, &ud))
	{
		return _T("");
	}

	TCHAR *weeks[]={_T("Sun"),_T("Mon"),_T("Tue"),_T("Wen"),_T("Thu"),_T("Fri"),_T("Sat")};
	TCHAR *month[]={_T("JAN"),_T("FEB"),_T("MAR"),_T("APR"),
					_T("MAY"),_T("JUN"),_T("JUL"),_T("AUG"),
					_T("SEP"),_T("OCT"),_T("NOV"),_T("DEC")};

	TIME_ZONE_INFORMATION stTimeZone;
	GetTimeZoneInformation(&stTimeZone);

	CString strDate;
	strDate.Format(_T("%s, %d %s %02d %d:%d:%d %c%04d")
		,weeks[ud.st.wDayOfWeek],
		ud.st.wDay,month[ud.st.wMonth-1],ud.st.wYear%100,ud.st.wHour,
		ud.st.wMinute,ud.st.wSecond,
		stTimeZone.Bias>0?_T('-'):_T('+'),
		abs(stTimeZone.Bias*10/6)
		);
	return strDate;
}
void CBCGPRecurrenceRuleWeekly::CorrectStart ()
{
	COleDateTime dt (GetDateStart ());

	int nWD = dt.GetDayOfWeek () - 1;

	int nWDS = TypeToDayOfWeek (GetStartDay ()) - 1;

	if (nWD == 0)
	{
		nWD = 7;
	}

	if (nWDS == 0)
	{
		nWDS = 7;
	}

	if (nWD != nWDS)
	{
		int delta = nWDS - nWD;
		if (delta < 0)
		{
			delta += 7;
		}

		dt += COleDateTimeSpan (delta, 0, 0, 0);
	}

	if (dt != GetDateStart ())
	{
		SetDateStart (dt);
	}
}
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);
	}
}
void CBCGPRecurrenceRuleYearly::CorrectStart ()
{
	COleDateTime dt (GetDateStart ());

	int y = dt.GetYear ();
	int m = m_Type == BCGP_REC_RULE_YEARLY_TYPE_DAY ? m_dwDayMonth : m_dwDayTypeMonth;
	int d = GetPossibleDay (y);

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

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

	if (dt < GetDateStart ())
	{
		y++;
		
		d = GetPossibleDay (y);
		nDays = CBCGPCalendar::GetMaxMonthDay (m, y);

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

	if (dt != GetDateStart ())
	{
		SetDateStart (dt);
	}
}
///////////////////////////////////////////////////////////////////////////
//	Name:	DATETimestampToStevesTimestampStrings
//
//	Description:
//	Convert the DATE timestamp to the two formats expected for the IR table strings
//	1234519970103093456000 and yyyymmdd - xx:xx:xx
//
//	Declaration:
//	CString CMyDateTime::DATETimestampToStevesDateAndTime(const DATE dTimestamp)
//
//	Input:	Timestamp	- DATE timestamp to convert
//			
//	Output:	none
//
//	Return:	CString		- Date/Time expressed in IR format of yyyymmdd - xx:xx:xx
//	
//  date    /	author	revision
//  -----------------	--------
//	01-Jun-2002	SFK		Created from MyDoubleTimestampToStevesDateAndTime in OleTimeUtils.cpp
//	05-May-2003	SFK		Fixed to actually return strings formed.
//	20-May-2003	SFK		Fixed to return correctly formatted year in szStrFormat1
//////////////////////////////////////////////////////////////////
void CMyDateTime::DATETimestampToStevesTimestampStrings(const DATE dTimestamp, char *szStrFormat1, char *szStrFormat2)
{
	CString strTemp1, strTemp2;
	COleDateTime DateTime;
	char szTime[STEVES_TIMESTAMP_LEN+1], szDate[STEVES_TIMESTAMP_LEN+1];
	DateTime.m_dt = dTimestamp;

	DATETimestampToDateTimeStrs(dTimestamp, szDate, szTime);
	szDate[2] = '\0';
	int iYear = atoi(szDate);
	//if (iYear < 52) iYear +=20;
	//else iYear += 19;
	if (iYear < 52) iYear =20;
	else iYear = 19;
	szDate[5] = '\0';
	szTime[2] = '\0';
	szTime[5] = '\0';
	strTemp1.Format("00000%2d%s%s%s%s%s%s000", iYear, &szDate[0], &szDate[3], &szDate[6], 
					                              &szTime[0], &szTime[3], &szTime[6]);

	strTemp2 = DateTime.Format("%Y.%m.%d - %H:%M:%S");

	strcpy(szStrFormat1, strTemp1.GetBuffer(strTemp1.GetLength()));		// sfk 5/15/2003
	strcpy(szStrFormat2, strTemp2.GetBuffer(strTemp2.GetLength()));		// sfk 5/15/2003

}
Example #14
0
int CExtIdDetail::validate_date( CEdit &EditDate, LPTSTR(VarName) ) 
{
	CString DateString;
	EditDate.GetWindowText(DateString);

	// does some nifty date time validation things.....
	COleDateTime CheckTime;
	enum COleDateTime::DateTimeStatus InputDateStatus;

	int status = ABP_SUCCESS;
	CString ErrorMsg;

	if( !DateString.IsEmpty() )
	{
		CheckTime.SetTime( 0, 0, 0);
		// parse the date string.....
		CheckTime.ParseDateTime( DateString, VAR_DATEVALUEONLY, LANG_USER_DEFAULT );
		// check for a valid date...
		InputDateStatus = CheckTime.GetStatus();

		if( InputDateStatus == COleDateTime::invalid )  // invalid date
		{
			CGuiMsg::GuiMessage(GUIMSG_DATE_INVALID);
			DateString.Empty();
			EditDate.SetWindowText(DateString);
			UpdateData(FALSE);
			status = ABP_FAILURE;
		}
	}
	return status;
}
Example #15
0
// after focus moves...validate date for the ToDate CString var
void CNotesDlg::OnKillfocusNoteDateToTxt() 
{
   UpdateData(TRUE);

   int valid = ABP_FAILURE;

   valid = validate_date( m_sDateTo, "ToDate" );

   // check to see if from time < to time
   if( valid == ABP_SUCCESS )
   {
      COleDateTime CheckFromTime;
      COleDateTime CheckToTime;

      if( !m_sDateFrom.IsEmpty() && !m_sDateTo.IsEmpty() )
	  {
	     // parse the date string.....
	     CheckFromTime.ParseDateTime( m_sDateFrom, VAR_DATEVALUEONLY, LCID_ENGLISH );
	     CheckToTime.ParseDateTime( m_sDateTo, VAR_DATEVALUEONLY, LCID_ENGLISH );

	     if( CheckFromTime > CheckToTime )
	     {
		    Beep( 400, 100 );
	        CGuiMsg::GuiMessage( GUIMSG_DATE_TO_BEFORE_FROM_DATE );
	        m_sDateTo.Empty();
			UpdateData(FALSE);
	     }
	  }
   }
}
Example #16
0
void CWizSync::startDownloadObjectsData()
{
    Q_EMIT processLog(tr("downloading objects data"));
    Q_EMIT progressChanged(progressAttachmentUploaded);

    m_db.GetAllObjectsNeedToBeDownloaded(m_arrayAllObjectsNeedToBeDownloaded);

    if (!m_bDownloadAllNotesData)
    {
        COleDateTime tNow = ::WizGetCurrentTime();

        size_t count = m_arrayAllObjectsNeedToBeDownloaded.size();
        for (intptr_t i = count - 1; i >= 0; i--)
        {
            COleDateTime t = m_arrayAllObjectsNeedToBeDownloaded[i].tTime;
            t = t.addDays(7);
            if (t < tNow)
            {
                m_arrayAllObjectsNeedToBeDownloaded.erase(m_arrayAllObjectsNeedToBeDownloaded.begin() + i);
                continue;
            }

            if (m_arrayAllObjectsNeedToBeDownloaded[i].eObjectType == wizobjectDocumentAttachment)
            {
                m_arrayAllObjectsNeedToBeDownloaded.erase(m_arrayAllObjectsNeedToBeDownloaded.begin() + i);
                continue;
            }
        }
    }

    downloadNextObjectData();
}
Example #17
0
BOOL CNotesDlg::CompareDateFromDateToTxt() 
{
	UpdateData(TRUE);

	COleDateTime CheckFromTime;
	COleDateTime CheckToTime;

	if( !m_sDateFrom.IsEmpty() && !m_sDateTo.IsEmpty() )
	{
		// parse the date string.....
		CheckFromTime.ParseDateTime( m_sDateFrom, VAR_DATEVALUEONLY, LCID_ENGLISH );
		CheckToTime.ParseDateTime( m_sDateTo, VAR_DATEVALUEONLY, LCID_ENGLISH );

		if( CheckFromTime > CheckToTime )
		{
			CGuiMsg::GuiMessage( GUIMSG_DATE_TO_BEFORE_FROM_DATE );
			m_sDateTo.Empty();
			UpdateData(FALSE);
			return FALSE;
		}
	}

	return TRUE;

}
Example #18
0
int mesage_SetPathValue(lua_State* L)
{
	CString type = luaL_typename(L,3);
	if(type == "string")
	{
		CString str = luaL_checkstring(L,3);
		COleDateTime dt;
		if(dt.ParseDateTime(str))
		{
			cmessage_arg(L,"mesage_SetPathValue")->SetDatumByPath(luaL_checkstring(L,2),COleVariant(dt));
		}else{
			cmessage_arg(L,"mesage_SetPathValue")->SetDatumByPath(luaL_checkstring(L,2),COleVariant(str));
		}
	}else if(type == "number")
	{
		cmessage_arg(L,"mesage_SetPathValue")->SetDatumByPath(luaL_checkstring(L,2),COleVariant(luaL_checknumber(L,3)));
	}else if(type == "boolean")
	{
		VARIANT var;
		var.vt = VT_BOOL;
		var.boolVal = (lua_toboolean(L,3)==1);
		cmessage_arg(L,"mesage_SetPathValue")->SetDatumByPath(luaL_checkstring(L,2),var);
	}else if(type == "nil")
	{
		VARIANT var;
		var.vt = VT_NULL;
		cmessage_arg(L,"mesage_SetPathValue")->SetDatumByPath(luaL_checkstring(L,2),var);
	}else
	{
		throw_L_error(L, "Invalid type of value");
	}
	return 0;
}
Example #19
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;
}
Example #20
0
void COXCalendarEdit::OnDropButton()
{
	CRect rect;
	GetClientRect(rect);
	ClientToScreen(rect);
	rect.right += GetButtonWidth();
	CRect rectParent = rect;
	rect.top = rect.bottom;
	rect.left = rect.right;

	// Get the size of the calendar control
	RECT rectSize;
	m_Calendar.GetMinReqRect(&rectSize);
	rect.left -= rectSize.right;
	rect.bottom += rectSize.bottom;
	
	// Read the initial date
	CString strText;
	GetWindowText(strText);
	COleDateTime dtInitialDate = GetDateFromString(strText);
	if (dtInitialDate.GetStatus() != COleDateTime::valid)
		dtInitialDate = COleDateTime::GetCurrentTime();

	// Display the calendar popup window
	COleDateTime dtPickedDate;
	BOOL bDatePicked = m_Calendar.Pick(rect, rectParent, dtInitialDate, dtPickedDate);
	if (bDatePicked)
		SetWindowText(GetStringFromDate(dtPickedDate));
}
void CDialogCompanies::OnButtonNew() 
{
	CDialogNameAndTicker dlg;
	if(dlg.DoModal() != IDOK)
		return;

	CCompany* pCompany = new CCompany();
	pCompany->SetTicker(dlg.m_sTicker);
	pCompany->SetName(dlg.m_sName);

	COleDateTime now = COleDateTime::GetCurrentTime();
	pCompany->SetYear(now.GetYear());

	CString sItem;
	sItem.Format("%s - %s", pCompany->GetTicker(), pCompany->GetName());
	m_nIndexAdding = m_List.AddString(sItem);
	m_List.SetItemData(m_nIndexAdding, (DWORD)pCompany);
	m_List.SetCurSel(m_nIndexAdding);
	SetValues(m_nIndexAdding);

	m_bAdding = true;
	
	GetDlgItem(ID_BUTTON_NEW)->EnableWindow(false);
	GetDlgItem(ID_BUTTON_DELETE)->EnableWindow(false);
	GetDlgItem(ID_BUTTON_SAVE)->SetWindowText("Add");
}
Example #22
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);
}
Example #23
0
void CRESTOREDLG::SetListStyle()
{
    m_list.InsertColumn(0,"序号",LVCFMT_LEFT,100);
	m_list.InsertColumn(1,"时间",LVCFMT_LEFT,140);
	m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
    m_record=NULL;
	m_record.CreateInstance(__uuidof(Recordset));
	CString sqlstr;
	sqlstr.Format("select * from tb_backup");
	m_record->Open((_variant_t )sqlstr,theApp.m_connection.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
	try
	{
		int i=0;
		while(!m_record->_EOF)
		{
			CString str=(LPCSTR)(_bstr_t)m_record->Fields->GetItem("id")->Value;
			m_list.InsertItem(i,str);
			COleDateTime tm;
			tm=(COleDateTime)m_record->Fields->GetItem("backuptime")->Value;
		    m_list.SetItemText(i,1,tm.Format("%Y-%m-%d-%H:%M:%S"));
			i++;
			m_record->MoveNext();
		}
	}
	catch(...)
	{
		MessageBox("没有还原记录!");
		CDialog::OnCancel();
	}
}
// 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
}
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);
}
Example #26
0
// time stamp format:	sssssYYYYMMDDHHMMSSmmm
// where:
//	            sssss	Station number (not used, always 0)
//	         YYYYMMDD	Date
//		   DDHHMM	Time
//		      mmm	milliseconds (always 0)
void CFieldDate::ConvertToTimestampStr (int y, int m, int d, CString& time_stamp)
{
	COleDateTime foo;
	foo.SetDate(y,m,d);
	time_stamp = foo.Format("00000%Y%m%d000000000");

}
	BOOL CallContextDayNote(SYSTEMTIME Time, HWND hCalendar)
	{
		CStringArray arr;
		arr.Add(_l("New reminder"));
		arr.Add(_l("Add date to clipboard"));
		int iSelection=SelectFromMenu(arr,0);
		if(iSelection<0){
			return 0;
		}
		if(iSelection==0){
			return -1;
		}
		CString s="";
		COleDateTime tm;//=COleDateTime(Time);
		tm.SetDate(Time.wYear,Time.wMonth,Time.wDay);
		if(strlen(szDateFormat)==0){
			s=DateFormat(tm,FALSE);
		}else{
			SYSTEMTIME EventTime;
			tm.GetAsSystemTime(EventTime);
			char szTmp[1020]={0};
			GetDateFormat(LOCALE_USER_DEFAULT,0,&EventTime,szDateFormat,szTmp,sizeof(szTmp));
			s=szTmp;
		}
		BOOL bThroughGlobal=0;
		USES_CONVERSION;
		SetClipboardText(A2W(s),bThroughGlobal,0);
		return 0;
	};
void CWizCategoryViewAllFoldersItem::getDocuments(CWizDatabase& db, CWizDocumentDataArray& arrayDocument)
{
    COleDateTime t = ::WizGetCurrentTime();
    t = t.addDays(-60);

    db.GetRecentDocumentsByCreatedTime(t, arrayDocument);
}
Example #29
0
/////////////////////////////////////////////////////////////////////////////
// CEOSSPropertySheet message handlers
void CEOSSPropertySheet::UpdateSummary(char *Message)
{
	CString Data;
	CEOSSSummary*  summarypage	 = m_pParent->m_pSummaryPage;

	summarypage->GetDlgItemText(IDC_EOSSSUMMARY_COMMAND10,Data);
	summarypage->SetDlgItemText(IDC_EOSSSUMMARY_COMMAND11,Data);
	summarypage->GetDlgItemText(IDC_EOSSSUMMARY_COMMAND9,Data);
	summarypage->SetDlgItemText(IDC_EOSSSUMMARY_COMMAND10,Data);
	summarypage->GetDlgItemText(IDC_EOSSSUMMARY_COMMAND8,Data);
	summarypage->SetDlgItemText(IDC_EOSSSUMMARY_COMMAND9,Data);
	summarypage->GetDlgItemText(IDC_EOSSSUMMARY_COMMAND7,Data);
	summarypage->SetDlgItemText(IDC_EOSSSUMMARY_COMMAND8,Data);
	summarypage->GetDlgItemText(IDC_EOSSSUMMARY_COMMAND6,Data);
	summarypage->SetDlgItemText(IDC_EOSSSUMMARY_COMMAND7,Data);
	summarypage->GetDlgItemText(IDC_EOSSSUMMARY_COMMAND5,Data);
	summarypage->SetDlgItemText(IDC_EOSSSUMMARY_COMMAND6,Data);
	summarypage->GetDlgItemText(IDC_EOSSSUMMARY_COMMAND4,Data);
	summarypage->SetDlgItemText(IDC_EOSSSUMMARY_COMMAND5,Data);
	summarypage->GetDlgItemText(IDC_EOSSSUMMARY_COMMAND3,Data);
	summarypage->SetDlgItemText(IDC_EOSSSUMMARY_COMMAND4,Data);
	summarypage->GetDlgItemText(IDC_EOSSSUMMARY_COMMAND2,Data);
	summarypage->SetDlgItemText(IDC_EOSSSUMMARY_COMMAND3,Data);
	summarypage->GetDlgItemText(IDC_EOSSSUMMARY_COMMAND1,Data);
	summarypage->SetDlgItemText(IDC_EOSSSUMMARY_COMMAND2,Data);
	COleDateTime cNow = COleDateTime::GetCurrentTime();
	Data = cNow.Format("%Y.%m.%d %H:%M:%S ");
	Data += Message;
	summarypage->SetDlgItemText(IDC_EOSSSUMMARY_COMMAND1,Data);
}
Example #30
0
void CAxUI::CheckSystemTime(void)
{
	wstring wstrHWID = CA2W(GenHWID2().c_str());
	CDownloadThread downloadThread;
	downloadThread.DownLoadInit(wstrHWID.c_str(), (CHostContainer::GetInstance()->GetHostName(kPUserServerTime)).c_str(), (LPSTR)"");
	char chTemp[1024] = {0};
	DWORD dwRead = 0;
	if (ERR_SUCCESS != downloadThread.ReadDataFromSever(chTemp, 1024, &dwRead))
	{
		CRecordProgram::GetInstance()->FeedbackError(MY_PRO_NAME, MY_THREAD_IE_EXTERNEL, L"获取服务器时间失败");
		return;
	}
	else
	{
		string strRead = chTemp;
		if(strRead.size() <= 0)
			return;
		// 读取KEK
		string strTag = MY_PARAM_END_TAG;
		strRead = strRead.substr(strRead.find(MY_PARAM_END_TAG) + strTag.length(), strRead.length());
		string strServerTime = strRead.substr(0, strRead.find(MY_PARAM_END_TAG));
		if (strServerTime.length() <= 0)
			return;

		COleDateTime oleTServer;
		oleTServer.ParseDateTime(CA2W(strServerTime.c_str()));
		COleDateTime oleTCurrent = COleDateTime::GetCurrentTime();
		COleDateTimeSpan oleTSpan1 = oleTServer - oleTCurrent;
		COleDateTimeSpan oleTSpan2 = oleTCurrent - oleTServer;
		if(oleTSpan1.GetTotalMinutes() > 30 || oleTSpan2.GetTotalMinutes() > 30)
		{
			::mhMessageBox(NULL, L"检测到您的系统时间与标准时间有较大误差,这将影响的同步功能的正常使用,推荐您进行修改!", L"财金汇", MB_OK | MB_ICONINFORMATION);
		}
	}
}