当前位置: 首页>>代码示例>>C++>>正文


C++ FormatTime函数代码示例

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


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


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