• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FormatTime函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FormatTime函数的典型用法代码示例。如果您正苦于以下问题:C++ FormatTime函数的具体用法?C++ FormatTime怎么用?C++ FormatTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FormatTime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: wxGetApp

void CViewTransfers::GetDocStatus(wxInt32 item, wxString& strBuffer) const {
    FILE_TRANSFER* transfer = NULL;
    CMainDocument* pDoc = wxGetApp().GetDocument();
    int retval;
    strBuffer = wxString("", wxConvUTF8);
    
    transfer = pDoc->file_transfer(item);
    if (!transfer) return;
    CC_STATUS      status;

    wxASSERT(pDoc);
    wxASSERT(wxDynamicCast(pDoc, CMainDocument));

    retval = pDoc->GetCoreClientStatus(status);
    if (retval) return;

    wxDateTime dtNextRequest((time_t)transfer->next_request_time);
    wxDateTime dtNow(wxDateTime::Now());

    strBuffer = transfer->is_upload?_("Upload"):_("Download");
    strBuffer += wxString(": ", wxConvUTF8);
    if (dtNextRequest > dtNow) {
        wxTimeSpan tsNextRequest(dtNextRequest - dtNow);
        strBuffer += _("retry in ") + tsNextRequest.Format();
    } else if (transfer->status == ERR_GIVEUP_DOWNLOAD || transfer->status == ERR_GIVEUP_UPLOAD) {
        strBuffer = _("failed");
    } else {
        if (status.network_suspend_reason) {
            strBuffer += _("suspended");
            strBuffer += wxString(" - ", wxConvUTF8);
            strBuffer += suspend_reason_wxstring(status.network_suspend_reason);
        } else {
            if (transfer->xfer_active) {
                strBuffer += _("active");
            } else {
                strBuffer += _("pending");
            }
        }
    }
    if (transfer->project_backoff) {
        wxString x;
        FormatTime(transfer->project_backoff, x);
        strBuffer += _(" (project backoff: ") + x + _(")");
    }
}
开发者ID:Ocode,项目名称:boinc,代码行数:45,代码来源:ViewTransfers.cpp


示例2: FormatTime

void ParamEdit::SearchResultReceived(DatabaseQuery *q) {
	if (q->search_data.response != -1) {
		m_current_search_date = q->search_data.response;
		m_draws_ctrl->Set(m_current_search_date);	
		m_found_date_label->SetLabel(wxString::Format(_("Found time: %s"), FormatTime(m_current_search_date, m_draws_ctrl->GetPeriod()).c_str()));
	} else {
		m_info_string = wxString::Format(_("%s"), _("No date found"));
	}
	DefinedParam* dp = dynamic_cast<DefinedParam*>(q->draw_info->GetParam());
	std::vector<DefinedParam*> dpv(1, dp);
	m_database_manager->RemoveParams(dpv);
	m_cfg_mgr->GetDefinedDrawsSets()->RemoveParam(dp);
	delete q->search_data.search_condition;
	delete q->draw_info;
	delete q;

	m_search_direction = NOT_SEARCHING;
}
开发者ID:cyclefusion,项目名称:szarp,代码行数:18,代码来源:paredit.cpp


示例3: GetFilteredIndex

wxString CViewMessages::OnListGetItemText(long item, long column) const {
    wxString strBuffer = wxEmptyString;
    size_t index = GetFilteredIndex(item);

    switch(column) {
    case COLUMN_PROJECT:
        FormatProjectName(index, strBuffer);
        break;
    case COLUMN_TIME:
        FormatTime(index, strBuffer);
        break;
    case COLUMN_MESSAGE:
        FormatMessage(index, strBuffer);
        break;
    }

    return strBuffer;
}
开发者ID:phenix3443,项目名称:synecdoche,代码行数:18,代码来源:ViewMessages.cpp


示例4: main

int main(int argc, char **argv)
{
  Args args(argc, argv, "DRIVER FILE");
  DebugReplay *replay = CreateDebugReplay(args);
  if (replay == NULL)
    return EXIT_FAILURE;

  args.ExpectEnd();

  printf("# time wind_bearing (deg) wind_speed (m/s) grndspeed (m/s) tas (m/s) bearing (deg)\n");

  CirclingSettings circling_settings;
  circling_settings.SetDefaults();

  CirclingComputer circling_computer;
  circling_computer.Reset();

  WindEKFGlue wind_ekf;
  wind_ekf.Reset();

  while (replay->Next()) {
    const MoreData &data = replay->Basic();
    const DerivedInfo &calculated = replay->Calculated();

    circling_computer.TurnRate(replay->SetCalculated(),
                               data, calculated.flight);

    WindEKFGlue::Result result =
      wind_ekf.Update(data, replay->Calculated());
    if (result.quality > 0) {
      TCHAR time_buffer[32];
      FormatTime(time_buffer, data.time);

      _tprintf(_T("%s %d %g %g %g %d\n"), time_buffer,
               (int)result.wind.bearing.Degrees(),
               (double)result.wind.norm,
               (double)data.ground_speed,
               (double)data.true_airspeed,
               (int)data.track.Degrees());
    }
  }

  delete replay;
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:44,代码来源:RunWindEKF.cpp


示例5: timeStamp

Logger::Impl::Impl(LogLevel eLevel, int nOldErrno, const char* pStrFile, int nLine)
	: timeStamp(TimeStamp::Now())
	, stream()
	, level(eLevel)
	, nLine(nLine)
	, pStrFullName(pStrFile)
	, pStrBaseName(NULL)
{
	const char* pStrPathSepPos = strrchr(pStrFullName, '/');
	pStrBaseName = (NULL != pStrPathSepPos) ? pStrPathSepPos + 1 : pStrFullName;

	FormatTime();
// 	Fmt tid("%6d", CurrentThread::GetTid());
// 	stream << tid.GetData();
	stream << "[" << LogLevelName[level] << "]\t";
	if (0 != nOldErrno) {
		stream << StrError_tl(nOldErrno) << " (errno=" << nOldErrno << ") ";
	}
}
开发者ID:yewenhui,项目名称:linuxserver,代码行数:19,代码来源:Logging.cpp


示例6: switch

void CFileBrowserListCtrl::OnGetdispinfo(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NMLVDISPINFO* pDispInfo = (NMLVDISPINFO*)pNMHDR;
	LVITEM&	ListItem = pDispInfo->item;
	int	ItemIdx = ListItem.iItem;
	if (ItemIdx < m_DirList.GetCount()) {
		const CDirItem&	DirItem = m_DirList.GetItem(ItemIdx);
		if (ItemIdx != m_CachedItemIdx) {	// if item isn't cached
			m_FileInfoCache.GetFileInfo(GetFolder(), DirItem, m_MRUFileInfo);
			m_CachedItemIdx = ItemIdx;
		}
		if (ListItem.mask & LVIF_TEXT) {
			switch (ListItem.iSubItem) {
			case COL_NAME:
				_tcscpy(ListItem.pszText, DirItem.GetName());
				break;
			case COL_SIZE:
				if (!DirItem.IsDir()) {
					CString	s;
					if (FormatSize(DirItem.GetLength(), s))
						_tcscpy(ListItem.pszText, s);
				}
				break;
			case COL_TYPE:
				_tcscpy(ListItem.pszText, m_MRUFileInfo.GetTypeName());
				break;
			case COL_MODIFIED:
				if (DirItem.GetLastWrite() > 0) {
					CString	s;
					if (FormatTime(DirItem.GetLastWrite(), s))
						_tcscpy(ListItem.pszText, s);
				}
				break;
			default:
				ASSERT(0);
			}
		}
		if (ListItem.mask & LVIF_IMAGE) {
			ListItem.iImage = m_MRUFileInfo.GetIconIdx();
		}
	}	
	*pResult = 0;
}
开发者ID:victimofleisure,项目名称:Fractice,代码行数:43,代码来源:FileBrowserListCtrl.cpp


示例7: TraceLog

static void TraceLog(uint16 port,ArCanMsgType* pMsg)
{
	static boolean is1stReceived=FALSE;
	static gchar log_buffer[512];
	int len = sprintf(log_buffer,"CANID=0x%-3x,DLC=%x, [",pMsg->Msg.Identifier,(guint)pMsg->Msg.DataLengthCode);
	for(int i=0;i<8;i++)
	{
		len += sprintf(&log_buffer[len],"%-2x,",(guint)pMsg->Msg.Data[i]);
	}
	gdouble elapsed = g_timer_elapsed(pTimer,NULL);
	if(FALSE == is1stReceived)
	{
		is1stReceived = TRUE;
		g_timer_start(pTimer);
		elapsed = 0;
	}
	len += sprintf(&log_buffer[len],"] %s from %-5d on bus %d\n",FormatTime(elapsed),port,pMsg->Msg.BusID);

	Trace(log_buffer);
}
开发者ID:uincore,项目名称:OpenSAR,代码行数:20,代码来源:arcan.c


示例8: FormatTime

wxString
wxLogFormatter::Format(wxLogLevel level,
                       const wxString& msg,
                       const wxLogRecordInfo& info) const
{
    wxString prefix;

    // don't time stamp debug messages under MSW as debug viewers usually
    // already have an option to do it
#ifdef __WINDOWS__
    if ( level != wxLOG_Debug && level != wxLOG_Trace )
#endif // __WINDOWS__
        prefix = FormatTime(info.timestamp);

    switch ( level )
    {
    case wxLOG_Error:
        prefix += _("Error: ");
        break;

    case wxLOG_Warning:
        prefix += _("Warning: ");
        break;

        // don't prepend "debug/trace" prefix under MSW as it goes to the debug
        // window anyhow and so can't be confused with something else
#ifndef __WINDOWS__
    case wxLOG_Debug:
        // this prefix (as well as the one below) is intentionally not
        // translated as nobody translates debug messages anyhow
        prefix += "Debug: ";
        break;

    case wxLOG_Trace:
        prefix += "Trace: ";
        break;
#endif // !__WINDOWS__
    }

    return prefix + msg;
}
开发者ID:madhugowda24,项目名称:wxWidgets,代码行数:41,代码来源:log.cpp


示例9: GetGroupInfoPtr

void CGroupInfoDlg::UpdateCtrls()
{
	CString strText;

	CGroupInfo * lpGroupInfo = GetGroupInfoPtr();
	if (lpGroupInfo != NULL)
	{
		SetDlgItemText(ID_EDIT_NAME, lpGroupInfo->m_strName.c_str());
		strText.Format(_T("%u"), lpGroupInfo->m_nGroupNumber);
		SetDlgItemText(ID_EDIT_NUMBER, strText);
		CBuddyInfo * lpBuddyInfo = lpGroupInfo->GetMemberByUin(lpGroupInfo->m_nOwnerUin);
		if (lpBuddyInfo != NULL)
			SetDlgItemText(ID_EDIT_CREATER, lpBuddyInfo->m_strNickName.c_str());
		TCHAR cTime[32] = {0};
		FormatTime(lpGroupInfo->m_nCreateTime, _T("%Y-%m-%d"), cTime, sizeof(cTime)/sizeof(TCHAR));
		SetDlgItemText(ID_EDIT_CREATETIME, cTime);
		strText.Format(_T("%u"), lpGroupInfo->m_nClass);
		SetDlgItemText(ID_EDIT_CLASS, strText);
		SetDlgItemText(ID_EDIT_REMARK, _T(""));
		SetDlgItemText(ID_EDIT_MEMO, lpGroupInfo->m_strMemo.c_str());
		SetDlgItemText(ID_EDIT_FINGERMEMO, lpGroupInfo->m_strFingerMemo.c_str());

		lpBuddyInfo = m_lpQQClient->GetUserInfo();
		if (lpBuddyInfo != NULL)
		{
			lpBuddyInfo = lpGroupInfo->GetMemberByUin(lpBuddyInfo->m_nQQUin);
			if (lpBuddyInfo != NULL)
			{
				if (!lpBuddyInfo->m_strGroupCard.empty())
					SetDlgItemText(ID_EDIT_CARDNAME, lpBuddyInfo->m_strGroupCard.c_str());
				else
					SetDlgItemText(ID_EDIT_CARDNAME, lpBuddyInfo->m_strNickName.c_str());
				SetDlgItemText(ID_EDIT_GENDER, lpBuddyInfo->GetDisplayGender().c_str());
				SetDlgItemText(ID_EDIT_PHONE, lpBuddyInfo->m_strPhone.c_str());
				SetDlgItemText(ID_EDIT_EMAIL, lpBuddyInfo->m_strEmail.c_str());
				SetDlgItemText(ID_EDIT_REMARK2, _T(""));
			}
		}
	}
}
开发者ID:03050903,项目名称:MingQQ,代码行数:40,代码来源:GroupInfoDlg.cpp


示例10: Replicas_GetColumnText

LPTSTR Replicas_GetColumnText (LPIDENT lpi, REPLICACOLUMN repcol)
{
   static TCHAR aszBuffer[ nREPLICACOLUMNS ][ cchRESOURCE ];
   static size_t iBufferNext = 0;
   LPTSTR pszBuffer = aszBuffer[ iBufferNext++ ];
   if (iBufferNext == nREPLICACOLUMNS)
      iBufferNext = 0;

   LPFILESETSTATUS lpfs = NULL;
   LPFILESET_PREF lpfp;
   if ((lpfp = (LPFILESET_PREF)lpi->GetUserParam()) != NULL)
      {
      lpfs = &lpfp->fsLast;
      }

   switch (repcol)
      {
      case repcolSERVER:
         lpi->GetServerName (pszBuffer);
         break;

      case repcolAGGREGATE:
         lpi->GetAggregateName (pszBuffer);
         break;

      case repcolDATE_UPDATE:
         if (!lpfs)
            *pszBuffer = TEXT('\0');
         else if (!FormatTime (pszBuffer, TEXT("%s"), &lpfs->timeLastUpdate))
            *pszBuffer = TEXT('\0');
         break;

      default:
         pszBuffer = NULL;
         break;
      }

   return pszBuffer;
}
开发者ID:chanke,项目名称:openafs-osd,代码行数:39,代码来源:set_col.cpp


示例11: FormatTime

void CMainWindow::AddMsgToRecvEdit(LPCTSTR lpText)
{
	if (NULL == lpText || NULL == *lpText)
		return;

	m_pRecvEdit->SetAutoURLDetect(true);

	tstring strTime;
	strTime = FormatTime(time(NULL), _T("%H:%M:%S"));

	ITextServices * pTextServices = m_pRecvEdit->GetTextServices();
	RichEdit_SetSel(pTextServices, -1, -1);

	TCHAR cText[2048] = {0};
	wsprintf(cText, _T("%s("), _T("倚天"));

	RichEdit_ReplaceSel(pTextServices, cText, 
		_T("宋体"), 9, RGB(0, 0, 255), FALSE, FALSE, FALSE, FALSE, 0);

	wsprintf(cText, _T("%u"), 43156150);
	RichEdit_ReplaceSel(pTextServices, cText, 
		_T("宋体"), 9, RGB(0, 114, 193), FALSE, FALSE, TRUE, TRUE, 0);

	wsprintf(cText, _T(")  %s\r\n"), strTime.c_str());
	RichEdit_ReplaceSel(pTextServices, cText, 
		_T("宋体"), 9, RGB(0, 0, 255), FALSE, FALSE, FALSE, FALSE, 0);

	//m_pRecvEdit->SetAutoURLDetect(true);

	AddMsg(m_pRecvEdit, lpText);

	RichEdit_ReplaceSel(pTextServices, _T("\r\n"));
	RichEdit_SetStartIndent(pTextServices, 0);
	m_pRecvEdit->EndDown();

	pTextServices->Release();
}
开发者ID:longlinht,项目名称:DirectUI,代码行数:37,代码来源:MainWindow.cpp


示例12: wxDynamicCast

void XYDialog::OnDateChange(wxCommandEvent &event) {
	wxButton *button;
	DTime *time;

	if (event.GetId() == XY_START_TIME) {
		button = wxDynamicCast(FindWindow(XY_START_TIME), wxButton);
		time = &m_start_time;
	} else {
		button = wxDynamicCast(FindWindow(XY_END_TIME), wxButton);
		time = &m_end_time;
	}

	DateChooserWidget *dcw = 
		new DateChooserWidget(
				this,
				_("Select date"),
				1,
				-1,
				-1,
				1
		);

	wxDateTime wxtime = time->GetTime();
	
	bool ret = dcw->GetDate(wxtime);
	dcw->Destroy();

	if (ret == false)
		return;

	*time = DTime(m_period, wxtime);
	time->AdjustToPeriod();

	button->SetLabel(FormatTime(time->GetTime(), m_period));

}
开发者ID:cyclefusion,项目名称:szarp,代码行数:36,代码来源:xydiag.cpp


示例13: ToWxDateTime

void StatDialog::DatabaseResponse(DatabaseQuery *q) {

    if (m_tofetch == 0) {
        delete q;
        return;
    }

    for (std::vector<DatabaseQuery::ValueData::V>::iterator i = q->value_data.vv->begin();
            i != q->value_data.vv->end();
            i++) {

        if (std::isnan(i->response))
            continue;

        if (m_count++ == 0) {
            m_max = i->response;
            m_min = i->response;
            m_sum = 0;
            m_sum2 = 0;
            m_hsum = 0;

            m_min_time = m_max_time = ToWxDateTime(i->time_second, i->time_nanosecond);
        } else {
            if (m_max < i->response) {
                m_max = i->response;
                m_max_time = ToWxDateTime(i->time_second, i->time_nanosecond);
            }

            if (m_min > i->response) {
                m_min = i->response;
                m_min_time = ToWxDateTime(i->time_second, i->time_nanosecond);
            }

        }

        m_sum += i->response;
        m_sum2 += i->response * i->response;
        m_hsum += i->sum;
    }

    m_pending -= q->value_data.vv->size();
    m_totalfetched += q->value_data.vv->size();

    delete q;

    assert(m_pending >= 0);

#if 0
    bool canceled;
    m_progress_dialog->Update(wxMin(99, int(float(m_totalfetched) / (m_tofetch + 1) * 100)), _T(""), &canceled);
#endif
    m_progress_frame->SetProgress(m_totalfetched * 100 / m_tofetch);

    if (m_totalfetched == m_tofetch) {

        assert(m_pending == 0);

        if (m_count) {
            wxString unit = m_draw->GetUnit();
            double sdev = sqrt(m_sum2 / m_count - m_sum / m_count * m_sum / m_count);

            m_min_value_text->SetLabel(wxString::Format(_T("%s %s (%s)"),
                                       m_draw->GetValueStr(m_min, _T("- -")).c_str(),
                                       unit.c_str(),
                                       FormatTime(m_min_time, m_period).c_str()));
            m_stddev_value_text->SetLabel(wxString::Format(_T("%s %s"),
                                          m_draw->GetValueStr(sdev, _T("- -")).c_str(),
                                          unit.c_str()));
            m_avg_value_text->SetLabel(wxString::Format(_T("%s %s"),
                                       m_draw->GetValueStr(m_sum / m_count, _T("- -")).c_str(),
                                       unit.c_str()));
            m_max_value_text->SetLabel(wxString::Format(_T("%s %s (%s)"),
                                       m_draw->GetValueStr(m_max, _T("- -")).c_str(),
                                       unit.c_str(),
                                       FormatTime(m_max_time, m_period).c_str()));
            if (m_draw->GetSpecial() == TDraw::HOURSUM) {
                if (unit.Replace(_T("/h"), _T("")) == 0)
                    unit += _T("h");
                m_hsum_value_text->SetLabel(wxString::Format(_T("%s %s"), m_draw->GetValueStr(m_hsum / m_draw->GetSumDivisor()).c_str(), unit.c_str()));
            }
        } else {
            m_min_value_text->SetLabel(_("no data"));
            m_avg_value_text->SetLabel(_("no data"));
            m_stddev_value_text->SetLabel(_("no data"));
            m_max_value_text->SetLabel(_("no data"));
            if (m_draw->GetSpecial() == TDraw::HOURSUM)
                m_hsum_value_text->SetLabel(_("no data"));
        }
        m_progress_frame->Destroy();

        m_tofetch = 0;

    } else if (m_pending == 0)
        ProgressFetch();
}
开发者ID:wds315,项目名称:szarp,代码行数:95,代码来源:statdiag.cpp


示例14: FormatTime

CString CTimeHelper::FormatTime(double dTime, int nDecPlaces) const
{
	return FormatTime(dTime, 0, nDecPlaces);
}
开发者ID:Fox-Heracles,项目名称:TodoList,代码行数:4,代码来源:TimeHelper.cpp


示例15: cmd_time

INT cmd_time (LPTSTR param)
{
	LPTSTR *arg;
	INT    argc;
	INT    i;
	INT    nTimeString = -1;

	if (!_tcsncmp (param, _T("/?"), 2))
	{
		ConOutResPaging(TRUE,STRING_TIME_HELP1);
		return 0;
	}

  nErrorLevel = 0;

	/* build parameter array */
	arg = split (param, &argc, FALSE, FALSE);

	/* check for options */
	for (i = 0; i < argc; i++)
	{
		if (_tcsicmp (arg[i], _T("/t")) == 0)
		{
			/* Display current time in short format */
			SYSTEMTIME st;
			TCHAR szTime[20];
			GetLocalTime(&st);
			FormatTime(szTime, &st);
			ConOutPuts(szTime);
			freep(arg);
			return 0;
		}

		if ((*arg[i] != _T('/')) && (nTimeString == -1))
			nTimeString = i;
	}

	if (nTimeString == -1)
	{
		ConOutResPrintf(STRING_LOCALE_HELP1);
		ConOutPrintf(_T(": %s\n"), GetTimeString());
	}

	while (1)
	{
		if (nTimeString == -1)
		{
			TCHAR  s[40];

			ConOutResPuts(STRING_TIME_HELP2);

			ConInString (s, 40);

			TRACE ("\'%s\'\n", debugstr_aw(s));

			while (*s && s[_tcslen (s) - 1] < _T(' '))
				s[_tcslen(s) - 1] = _T('\0');

			if (ParseTime (s))
			{
				freep (arg);
				return 0;
			}
		}
		else
		{
			if (ParseTime (arg[nTimeString]))
			{
				freep (arg);
				return 0;
			}

			/* force input the next time around. */
			nTimeString = -1;
		}

		ConErrResPuts(STRING_TIME_ERROR1);
    nErrorLevel = 1;
	}

	freep (arg);

	return 0;
}
开发者ID:RareHare,项目名称:reactos,代码行数:84,代码来源:time.c


示例16: ShowSocks

    void ShowSocks(bool bShowHosts) {
        CSockManager& m = CZNC::Get().GetManager();
        if (!m.size()) {
            PutStatus("You have no open sockets.");
            return;
        }

        std::priority_queue<CSocketSorter> socks;

        for (unsigned int a = 0; a < m.size(); a++) {
            socks.push(m[a]);
        }

        CTable Table;
        Table.AddColumn("Name");
        Table.AddColumn("Created");
        Table.AddColumn("State");
#ifdef HAVE_LIBSSL
        Table.AddColumn("SSL");
#endif
        Table.AddColumn("Local");
        Table.AddColumn("Remote");

        while (!socks.empty()) {
            Csock* pSocket = socks.top().GetSock();
            socks.pop();

            Table.AddRow();

            switch (pSocket->GetType()) {
            case Csock::LISTENER:
                Table.SetCell("State", "Listen");
                break;
            case Csock::INBOUND:
                Table.SetCell("State", "Inbound");
                break;
            case Csock::OUTBOUND:
                if (pSocket->IsConnected())
                    Table.SetCell("State", "Outbound");
                else
                    Table.SetCell("State", "Connecting");
                break;
            default:
                Table.SetCell("State", "UNKNOWN");
                break;
            }

            unsigned long long iStartTime = pSocket->GetStartTime();
            time_t iTime = iStartTime / 1000;
            Table.SetCell("Created", FormatTime("%Y-%m-%d %H:%M:%S", iTime));

#ifdef HAVE_LIBSSL
            if (pSocket->GetSSL()) {
                Table.SetCell("SSL", "Yes");
            } else {
                Table.SetCell("SSL", "No");
            }
#endif


            Table.SetCell("Name", pSocket->GetSockName());
            CString sVHost;
            if (bShowHosts) {
                sVHost = pSocket->GetBindHost();
            }
            if (sVHost.empty()) {
                sVHost = pSocket->GetLocalIP();
            }
            Table.SetCell("Local", sVHost + " " + CString(pSocket->GetLocalPort()));

            CString sHost;
            if (!bShowHosts) {
                sHost = pSocket->GetRemoteIP();
            }
            // While connecting, there might be no ip available
            if (sHost.empty()) {
                sHost = pSocket->GetHostName();
            }

            u_short uPort;
            // While connecting, GetRemotePort() would return 0
            if (pSocket->GetType() == Csock::OUTBOUND) {
                uPort = pSocket->GetPort();
            } else {
                uPort = pSocket->GetRemotePort();
            }
            if (uPort != 0) {
                Table.SetCell("Remote", sHost + " " + CString(uPort));
            } else {
                Table.SetCell("Remote", sHost);
            }
        }

        PutModule(Table);
        return;
    }
开发者ID:BGCX261,项目名称:znc-msvc-svn-to-git,代码行数:96,代码来源:listsockets.cpp


示例17: RunTest


//.........这里部分代码省略.........
				if (globalTestExpectedToFail)
				{
					if (globalTestExpectedToFail == 2)
						LOGE("This test failed as expected. Caught an exception '%s', failure is due to reason '%s'.", e.what(), globalTestFailureDescription.c_str());
					else
						LOGI("This test failed as expected. Caught an exception '%s', failure is due to reason '%s'.", e.what(), globalTestFailureDescription.c_str());
				}
				else
				{
					if (failReason.empty())
						failReason = e.what();
					++t.numFails;
				}
			}
			catch(...)
			{
				++t.numFails;
				LOGE("Error: Received an unknown exception type that is _not_ derived from std::exception! This should not happen!");
			}
#endif
		}
		tick_t end = Clock::Tick();
		times.push_back(end - start);
	}

	t.numPasses = numTimesToRun*numTrialsPerRun - t.numFails;
	std::sort(times.begin(), times.end());

	// Erase outliers. (x% slowest)
	const float rateSlowestToDiscard = 0.05f;
	int numSlowestToDiscard = (int)(times.size() * rateSlowestToDiscard);
	times.erase(times.end() - numSlowestToDiscard, times.end());

	tick_t total = 0;
	for(size_t j = 0; j < times.size(); ++j)
		total += times[j];

	if (!t.isBenchmark)
	{
		if (!times.empty())
		{
			t.fastestTime = (double)times[0] / numTrialsPerRun;
			t.averageTime = (double)total / times.size() / numTrialsPerRun;
			t.worstTime = (double)times.back() / numTrialsPerRun;
			t.numTimesRun = numTimesToRun;
			t.numTrialsPerRun = numTrialsPerRun;
		}
		else
		{
			t.fastestTime = t.averageTime = t.worstTime = -1.0;
			t.numTimesRun = t.numTrialsPerRun = 0;
		}
	}
	float successRate = (t.numPasses + t.numFails > 0) ? (float)t.numPasses * 100.f / (t.numPasses + t.numFails) : 0.f;

	jsonReport.Report(t);

	if (t.isBenchmark && t.numFails == 0) // Benchmarks print themselves.
		return 0; // 0: Success

	int ret = 0; // 0: Success

	if (t.numFails == 0)
	{
		if (t.isRandomized)
			LOGI(" ok (%d passes, 100%%)", t.numPasses);
		else
			LOGI(" ok ");
//		++numTestsPassed;
		t.result = TestPassed;
	}
	else if (successRate >= 95.0f)
	{
		LOGI_NL(" ok ");
		LOGW("Some failures with '%s' (%d passes, %.2f%% of all tries)", failReason.c_str(), t.numPasses, successRate);
//		++numTestsPassed;
//		++numWarnings;
		ret = 1; // Success with warnings
		t.result = TestPassedWithWarnings;
	}
	else
	{
		if (t.isRandomized)
			LOGE("FAILED: '%s' (%d passes, %.2f%% of all tries)", failReason.c_str(), t.numPasses, successRate);
		else
			LOGE("FAILED: '%s'", failReason.c_str());
		ret = -1; // Failed
		t.result = TestFailed;
	}

	if (!times.empty())
	{
		if (t.runOnlyOnce)
			LOGI("   Elapsed: %s", FormatTime((double)times[0]).c_str());
		else
			LOGI("   Fastest: %s, Average: %s, Slowest: %s", FormatTime(t.fastestTime).c_str(), FormatTime(t.averageTime).c_str(), FormatTime(t.worstTime).c_str());
	}

	return ret;
}
开发者ID:HsiaTsing,项目名称:MathGeoLib,代码行数:101,代码来源:TestRunner.cpp


示例18: MemMgr_OnListAdd

void MemMgr_OnListAdd (PMEMCHUNK pCopy)
{
   HWND hList = GetDlgItem (l.hManager, IDC_LIST);

   TCHAR szTime[256];
   FormatTime (szTime, pCopy->dwTick);

   TCHAR szFlags[256];
   LPTSTR pszFlags = szFlags;
   *pszFlags++ = (pCopy->fCPP) ? TEXT('C') : TEXT(' ');
   *pszFlags++ = TEXT(' ');
   *pszFlags++ = (pCopy->fFreed) ? TEXT('F') : TEXT(' ');
   *pszFlags++ = 0;

   TCHAR szExpr[256];
   lstrcpy (szExpr, (pCopy->pszExpr) ? pCopy->pszExpr : TEXT("unknown"));

   LPTSTR pszFile = pCopy->pszFile;
   for (LPTSTR psz = pCopy->pszFile; *psz; ++psz)
      {
      if ((*psz == TEXT(':')) || (*psz == TEXT('\\')))
         pszFile = &psz[1];
      }
   TCHAR szLocation[256];
   if (!pszFile || !pCopy->dwLine)
      lstrcpy (szLocation, TEXT("unknown"));
   else
      wsprintf (szLocation, TEXT("%s, %ld"), pszFile, pCopy->dwLine);

   TCHAR szBytes[256];
   FormatBytes (szBytes, (double)pCopy->cbData);

   TCHAR szAddress[256];
   wsprintf (szAddress, TEXT("0x%08p"), pCopy->pData);

   LPTSTR pszKey = NULL;
   switch (lr.iColSort)
      {
      case 0:  pszKey = (LPTSTR)UlongToPtr(pCopy->dwTick);  break;
      case 1:  pszKey = (LPTSTR)szFlags;        break;
      case 2:  pszKey = (LPTSTR)szExpr;         break;
      case 3:  pszKey = (LPTSTR)szLocation;     break;
      case 4:  pszKey = (LPTSTR)pCopy->cbData;  break;
      case 5:  pszKey = (LPTSTR)pCopy->pData;   break;
      }

   LV_ITEM Item;
   memset (&Item, 0x00, sizeof(Item));
   Item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
   Item.iItem = MemMgr_PickListInsertionPoint (hList, pszKey);
   Item.iSubItem = 0;
   Item.cchTextMax = 256;
   Item.lParam = (LPARAM)pCopy->pData;

   Item.pszText = szTime;
   DWORD iItem = ListView_InsertItem (hList, &Item);
   ListView_SetItemText (hList, iItem, 1, szFlags);
   ListView_SetItemText (hList, iItem, 2, szExpr);
   ListView_SetItemText (hList, iItem, 3, szLocation);
   ListView_SetItemText (hList, iItem, 4, szBytes);
   ListView_SetItemText (hList, iItem, 5, szAddress);

   delete pCopy;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:64,代码来源:tal_alloc.cpp


示例19: if

void ICPClass::ExecCNIMode() 
{
	AircraftClass *playerAC = SimDriver.GetPlayerAircraft();
	if (!playerAC) return;//me123 ctd fix
	if(!g_bRealisticAvionics)
	{
		int							type;
		static int					wpflags;
		static	int					frame = 0;
		char							timeStr[16]			= "";
		char							band;
		TacanList::StationSet	set;
		int							channel;
		VU_ID							vuId;

		



		{
										
			// Clear the update flag

			mUpdateFlags				&= !CNI_UPDATE;

			// Calculate Some Stuff
			if (playerAC->curWaypoint)
			{
				wpflags = playerAC->curWaypoint->GetWPFlags();
			}
			else
			{
				wpflags = 0;
			}

			if (wpflags & WPF_TARGET) 
			{
				type	= Way_TGT;
			}
			else if (wpflags & WPF_IP) 
			{
				type	= Way_IP;
			}
			else 
			{
				type	= Way_STPT;
			}
			//Original code
			// Format Line 1: Waypoint Num, Waypoint Type
			if(playerAC->FCC->GetStptMode() == FireControlComputer::FCCWaypoint) 
			{
			 sprintf(mpLine1, "COMM1 : %-12s STPT %-3d", (VM ? RadioStrings[VM->GetRadioFreq(0)] : "XXXX"), mWPIndex + 1);
			}
			else if(playerAC->FCC->GetStptMode() == FireControlComputer::FCCDLinkpoint) 
			{
				sprintf(mpLine1, "COMM1 : %-12s LINK %-3d", (VM ? RadioStrings[VM->GetRadioFreq(0)] : "XXXX"), gNavigationSys->GetDLinkIndex() + 1);
			}
			else if(playerAC->FCC->GetStptMode() == FireControlComputer::FCCMarkpoint) 
			{
				sprintf(mpLine1, "COMM1 : %-12s MARK %-3d", (VM ? RadioStrings[VM->GetRadioFreq(0)] : "XXXX"), gNavigationSys->GetMarkIndex() + 1);
			}


			// Format Line 2: Current Time
			FormatTime(vuxGameTime / 1000, timeStr);		// Get game time and convert to secs
			sprintf(mpLine2, "COMM2 : %-12s %8s", (VM ? RadioStrings[VM->GetRadioFreq(1)] : "XXXX"), timeStr);

			if(mICPTertiaryMode == COMM1_MODE) 
			{
				mpLine1[5] = '*';
			}
			else 
			{
				mpLine2[5] = '*';

			}

			// Format Line 3: Bogus IFF info, Tacan Channel
			if(gNavigationSys) 
			{
				gNavigationSys->GetTacanVUID(NavigationSystem::ICP, &vuId);	
				if(vuId) {
					gNavigationSys->GetTacanChannel(NavigationSystem::ICP, &channel, &set);

					if(set == TacanList::X) 
					{
						band = 'X';
					}
					else 
					{
						band = 'Y';
					}

					sprintf(mpLine3, "                    T%3d%c", channel, band);
				}
				else 
				{
					sprintf(mpLine3, "");
				}
			}
//.........这里部分代码省略.........
开发者ID:PlutoniumHeart,项目名称:VS2012FFalcon,代码行数:101,代码来源:IcpCNI.cpp


示例20: Filesets_General_OnEndTask_InitDialog

void Filesets_General_OnEndTask_InitDialog (HWND hDlg, LPTASKPACKET ptp, LPIDENT lpi)
{
   LPTSTR pszText;

   TCHAR szUnknown[ cchRESOURCE ];
   GetString (szUnknown, IDS_UNKNOWN);

   if (!ptp->rc)
      {
      SetDlgItemText (hDlg, IDC_SET_CREATEDATE, szUnknown);
      SetDlgItemText (hDlg, IDC_SET_UPDATEDATE, szUnknown);
      SetDlgItemText (hDlg, IDC_SET_ACCESSDATE, szUnknown);
      SetDlgItemText (hDlg, IDC_SET_BACKUPDATE, szUnknown);
      SetDlgItemText (hDlg, IDC_SET_USAGE, szUnknown);
      SetDlgItemText (hDlg, IDC_SET_STATUS, szUnknown);
      SetDlgItemText (hDlg, IDC_SET_FILES, szUnknown);

      TCHAR szSvrName[ cchNAME ];
      TCHAR szAggName[ cchNAME ];
      TCHAR szSetName[ cchNAME ];
      lpi->GetServerName (szSvrName);
      lpi->GetAggregateName (szAggName);
      lpi->GetFilesetName (szSetName);
      ErrorDialog (ptp->status, IDS_ERROR_REFRESH_FILESET_STATUS, TEXT("%s%s%s"), szSvrName, szAggName, szSetName);
      }
   else
      {
      TCHAR szText[ cchRESOURCE ];

      EnableWindow (GetDlgItem (hDlg, IDC_SET_LOCK), TRUE);
      EnableWindow (GetDlgItem (hDlg, IDC_SET_UNLOCK), TRUE);
      EnableWindow (GetDlgItem (hDlg, IDC_SET_QUOTA), TRUE);
      EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN), TRUE);
      EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL_DEF), TRUE);
      EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL), TRUE);
      EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL_PERCENT), TRUE);
      EnableWindow (GetDlgItem (hDlg, IDC_SET_WARN_SETFULL_DESC), TRUE);

      if (!FormatTime (szText, TEXT("%s"), &TASKDATA(ptp)->fs.timeCreation))
         SetDlgItemText (hDlg, IDC_SET_CREATEDATE, szUnknown);
      else
         SetDlgItemText (hDlg, IDC_SET_CREATEDATE, szText);

      if (!FormatTime (szText, TEXT("%s"), &TASKDATA(ptp)->fs.timeLastUpdate))
         SetDlgItemText (hDlg, IDC_SET_UPDATEDATE, szUnknown);
      else
         SetDlgItemText (hDlg, IDC_SET_UPDATEDATE, szText);

      if (!FormatTime (szText, TEXT("%s"), &TASKDATA(ptp)->fs.timeLastAccess))
         SetDlgItemText (hDlg, IDC_SET_ACCESSDATE, szUnknown);
      else
         SetDlgItemText (hDlg, IDC_SET_ACCESSDATE, szText);

      if (!FormatTime (szText, TEXT("%s"), &TASKDATA(ptp)->fs.timeLastBackup))
         SetDlgItemText (hDlg, IDC_SET_BACKUPDATE, szUnknown);
      else
         SetDlgItemText (hDlg, IDC_SET_BACKUPDATE, szText);

      wsprintf (szText, TEXT("%lu"), TASKDATA(ptp)->fs.nFiles);
      SetDlgItemText (hDlg, IDC_SET_FILES, szText);

      size_t nAlerts = Alert_GetCount (lpi);
      if (nAlerts == 1)
         {
         GetString (szText, IDS_SETSTATUS_1ALERT);
         SetDlgItemText (hDlg, IDC_SET_STATUS, szText);
         }
      else if (nAlerts > 1)
         {
         pszText = FormatString (IDS_SETSTATUS_2ALERT, TEXT("%lu"), nAlerts);
         SetDlgItemText (hDlg, IDC_SET_STATUS, pszText);
         FreeString (pszText);
         }
      else // (nAlerts == 0)
         {
         if (TASKDATA(ptp)->fs.State & fsBUSY)
            GetString (szText, IDS_SETSTATUS_BUSY);
         else if (TASKDATA(ptp)->fs.State & fsSALVAGE)
            GetString (szText, IDS_SETSTATUS_SALVAGE);
         else if (TASKDATA(ptp)->fs.State & fsMOVED)
            GetString (szText, IDS_SETSTATUS_MOVED);
         else if (TASKDATA(ptp)->fs.State & fsLOCKED)
            GetString (szText, IDS_SETSTATUS_LOCKED);
         else if (TASKDATA(ptp)->fs.State & fsNO_VOL)
            GetString (szText, IDS_SETSTATUS_NO_VOL);
         else
            GetString (szText, IDS_STATUS_NOALERTS);
         SetDlgItemText (hDlg, IDC_SET_STATUS, szText);
         }

      if (TASKDATA(ptp)->fs.Type == ftREADWRITE)
         {
         Filesets_DisplayQuota (hDlg, &TASKDATA(ptp)->fs);
         }
      else
         {
         if (TASKDATA(ptp)->fs.Type == ftREPLICA)
            GetString (szText, IDS_USAGE_REPLICA);
         else // (TASKDATA(ptp)->fs.Type == ftCLONE)
            GetString (szText, IDS_USAGE_CLONE);
//.........这里部分代码省略.........
开发者ID:bagdxk,项目名称:openafs,代码行数:101,代码来源:set_prop.cpp



注:本文中的FormatTime函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FormatTxStatus函数代码示例发布时间:2022-05-30
下一篇:
C++ FormatString函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap