本文整理汇总了C++中TimeSpan::GetSeconds方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeSpan::GetSeconds方法的具体用法?C++ TimeSpan::GetSeconds怎么用?C++ TimeSpan::GetSeconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeSpan
的用法示例。
在下文中一共展示了TimeSpan::GetSeconds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: uptime
void
Form2::SetTimer(void)
{
long long tick ;
// Get current tick value
Tizen::Base::TimeSpan uptime(0);
result r = Tizen::System::SystemTime::GetUptime(uptime);
if (IsFailed(r))
{
AppLog("System uptime not available\n");
return ;
}
tick = uptime.GetTicks();
tick -= __startTick;
TimeSpan span = static_cast<long>(tick);
String __watchText;
// Set StopWatch String
__watchText.Clear();
if(span.GetMinutes() < 10)
{
__watchText.Append("0");
}
__watchText.Append(span.GetMinutes());
__watchText.Append(":");
if(span.GetSeconds() < 10)
{
__watchText.Append("0");
}
__watchText.Append(span.GetSeconds());
__watchText.Append(":");
if(span.GetMilliseconds() / 10 < 10)
{
__watchText.Append("0");
}
__watchText.Append(span.GetMilliseconds() / 10);
__pLabel2->SetText(__watchText);
__pLabel2->Invalidate(false);
__pLabel2->Show();
return;
}
示例2: OnTimer
LRESULT CISOProgressDialog::OnTimer(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
{
extern bool AutorunErrorHandler(ActionStatus st);
BackgroundDriveReader::ProgressRecord progress = m_pReader->GetProgress();
unsigned progressVal = (unsigned)((progress.Done * kProgressRangeMax) / progress.Total);
if (progress.TotalBad)
{
if (m_pTaskbar)
m_pTaskbar->SetProgressState(m_hWnd, TBPF_INDETERMINATE);
m_ProgressBar.SetPos((int)((progress.ProcessedBad * kProgressRangeMax) / progress.TotalBad));
SetDlgItemText(IDC_PROGRESSLINE, String::sFormat(_TR(IDS_BADSECTORPROGRESSFMT, "Re-reading bad sectors (%d/%d)"), (int)progress.ProcessedBad, (int)progress.TotalBad).c_str());
}
else
{
if (m_pTaskbar)
m_pTaskbar->SetProgressValue(m_hWnd, progress.Done, progress.Total);
m_ProgressBar.SetPos(progressVal);
unsigned badSectorCount = m_pReader->GetTotalBadSectorCount();
if (!badSectorCount)
{
bool remainingTimeAccurate = false;
TimeSpan remainingTime = m_pReader->GetEstimatedRemainingTime(&remainingTimeAccurate);
String label = String::sFormat(_TR(IDS_SPEEDSTATFMT, "Average read speed: %s/s"), RateCalculator::FormatByteCount(progress.BytesPerSecond).c_str());
if (remainingTimeAccurate && (remainingTime.GetTotalSeconds() > 3))
label += String::sFormat(_TR(IDS_REMAININGTIMESUFFIX, ", remaining time: %02d:%02d"), remainingTime.GetTotalMinutes(), remainingTime.GetSeconds());
SetDlgItemText(IDC_PROGRESSLINE, label.c_str());
}
else
SetDlgItemText(IDC_PROGRESSLINE, String::sFormat(_TR(IDS_BADSECTFMT, "Average read speed: %s/s, %d bad sector(s) found"), RateCalculator::FormatByteCount(progress.BytesPerSecond).c_str(), badSectorCount).c_str());
}
if (m_pReader->QueryStatus().GetErrorCode() != Pending)
{
KillTimer(0);
::EnableWindow(GetDlgItem(IDC_PAUSE), FALSE);
ActionStatus st = m_pReader->QueryStatus();
if (st.Successful())
{
FunctionThread ejectThread(&EjectDriveProc, (PVOID)m_pReader->GetSourcePath());
if (SendDlgItemMessage(IDC_EJECTDISC, BM_GETCHECK) == BST_CHECKED)
ejectThread.Start();
if (SendDlgItemMessage(IDC_OPENFOLDER, BM_GETCHECK) == BST_CHECKED)
Win32::Process(Path::GetDirectoryName(ConstString(m_pReader->GetImagePath())).c_str(), _T("open"));
if (SendDlgItemMessage(IDC_MOUNTISO, BM_GETCHECK) == BST_CHECKED)
{
wchar_t wszKernelPath[512];
if (!VirtualCDClient::Win32FileNameToKernelFileName(m_pReader->GetImagePath(), wszKernelPath, __countof(wszKernelPath)))
MessageBox(_TR(IDS_BADIMGFN, "Invalid image file name!"), NULL, MB_ICONERROR);
else
{
TCHAR tsz[3] = {0,};
if (m_cbLetters.GetLBTextLen(m_cbLetters.GetCurSel()) < _countof(tsz))
m_cbLetters.GetLBText(m_cbLetters.GetCurSel(), tsz);
VirtualCDClient().ConnectDisk(wszKernelPath, (char)(tsz[0]), 0, m_RegParams.DisableAutorun, false, AutorunErrorHandler);
}
}
ejectThread.Join();
if (SendDlgItemMessage(IDC_CLOSEWINDOW, BM_GETCHECK) == BST_CHECKED)
{
EndDialog(IDOK);
SaveParams();
}
else
{
SetDlgItemText(IDCANCEL, _TR(IDS_CLOSE, "Close"));
m_ProgressBar.SetPos(kProgressRangeMax);
::SetFocus(GetDlgItem(IDCANCEL));
MessageBox(_TR(IDS_ISOCREATED, "The ISO image has been created successfully"), _TR(IDS_INFORMATION, "Information"), MB_ICONINFORMATION);
}
}
else
{
if (st.GetErrorCode() != OperationAborted)
MessageBox(st.GetMostInformativeText().c_str(), NULL, MB_ICONERROR);
DeleteFile(m_pReader->GetImagePath());
EndDialog(IDNO);
}
}
return 0;
}