本文整理汇总了C++中wxGetLocalTimeMillis函数的典型用法代码示例。如果您正苦于以下问题:C++ wxGetLocalTimeMillis函数的具体用法?C++ wxGetLocalTimeMillis怎么用?C++ wxGetLocalTimeMillis使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxGetLocalTimeMillis函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: locker
wxSemaError wxSemaphoreInternal::WaitTimeout(unsigned long milliseconds)
{
wxMutexLocker locker(m_mutex);
wxLongLong startTime = wxGetLocalTimeMillis();
while ( m_count == 0 )
{
wxLongLong elapsed = wxGetLocalTimeMillis() - startTime;
long remainingTime = (long)milliseconds - (long)elapsed.GetLo();
if ( remainingTime <= 0 )
{
// timeout
return wxSEMA_TIMEOUT;
}
switch ( m_cond.WaitTimeout(remainingTime) )
{
case wxCOND_TIMEOUT:
return wxSEMA_TIMEOUT;
default:
return wxSEMA_MISC_ERROR;
case wxCOND_NO_ERROR:
;
}
}
m_count--;
return wxSEMA_NO_ERROR;
}
示例2: Entry
/*****************************************************
**
** AtlasLogicCountWorker --- Entry
**
******************************************************/
ExitCode Entry()
{
while ( sharedSection->doExit == false )
{
Sleep( COUNT_THREAD_SLEEP_MILLISEC );
if ( sharedSection->countHasOrder )
{
#ifdef DEB_ATLAS_LOGIC
printf( "AtlasLogicCountWorker: location count started, filter \"%s\", country \"%s\", mode %d\n",
str2char( logic->filter ), str2char( logic->country ), logic->mode );
wxLongLong starttime = wxGetLocalTimeMillis();
#endif
sharedSection->countHasOrder = false;
int c = dao->getMatchCount( logic->filter, logic->country, logic->mode );
if ( sharedSection->countHasOrder )
{
// new order arrived, filter conditions have changed meanwhile: do not write results
printf( "WARN: AtlasLogicCountWorker has new order before finishing request\n" );
}
else
{
mutex.Lock();
sharedSection->countHasNews = true;
sharedSection->count = c;
mutex.Unlock();
#ifdef DEB_ATLAS_LOGIC
wxLongLong duration = wxGetLocalTimeMillis() - starttime;
printf( "AtlasLogicCountWorker: Location count finished, %d results in %ld millisec\n", c, duration.ToLong() );
#endif
}
}
}
return 0;
}
示例3: wxCOMPILE_TIME_ASSERT
int
wxEpollDispatcher::DoPoll(epoll_event *events, int numEvents, int timeout) const
{
// the code below relies on TIMEOUT_INFINITE being -1 so that we can pass
// timeout value directly to epoll_wait() which interprets -1 as meaning to
// wait forever and would need to be changed if the value of
// TIMEOUT_INFINITE ever changes
wxCOMPILE_TIME_ASSERT( TIMEOUT_INFINITE == -1, UpdateThisCode );
wxMilliClock_t timeEnd;
if ( timeout > 0 )
timeEnd = wxGetLocalTimeMillis();
int rc;
for ( ;; )
{
rc = epoll_wait(m_epollDescriptor, events, numEvents, timeout);
if ( rc != -1 || errno != EINTR )
break;
// we got interrupted, update the timeout and restart
if ( timeout > 0 )
{
timeout = wxMilliClockToLong(timeEnd - wxGetLocalTimeMillis());
if ( timeout < 0 )
return 0;
}
}
return rc;
}
示例4: ProfileFindInFilesCodeMode
void ProfileFindInFilesCodeMode() {
printf("*******\n");
wxLongLong time = wxGetLocalTimeMillis();
t4p::DirectorySearchClass directorySearch;
t4p::SourceClass src;
src.RootDirectory.AssignDir(DirName);
src.SetIncludeWildcards(wxT("*.php"));
std::vector<t4p::SourceClass> sources;
sources.push_back(src);
if (directorySearch.Init(sources)) {
t4p::FindInFilesClass findInFiles;
findInFiles.Expression = UNICODE_STRING_SIMPLE("class Db");
findInFiles.Mode = t4p::FinderClass::EXACT;
if (findInFiles.Prepare()) {
while (directorySearch.More()) {
directorySearch.Walk(findInFiles);
}
std::vector<wxString> matchedFiles = directorySearch.GetMatchedFiles();
for (size_t i = 0; i < matchedFiles.size(); ++i) {
printf("Found at least one match in file %s.\n", (const char*)matchedFiles[i].ToUTF8());
}
time = wxGetLocalTimeMillis() - time;
printf("time for findInFiles Code Mode:%ld ms\n", time.ToLong());
} else {
puts("Invalid expression: class Db\n");
}
} else {
printf("Could not open Directory: %s\n", (const char*)DirName.ToAscii());
}
}
示例5: ProfileFindInFilesExactMode
void ProfileFindInFilesExactMode() {
printf("*******\n");
wxLongLong time = wxGetLocalTimeMillis();
t4p::DirectorySearchClass directorySearch;
if (directorySearch.Init(DirName)) {
t4p::FindInFilesClass findInFiles;
findInFiles.Expression = UNICODE_STRING_SIMPLE("class Db");
findInFiles.Mode = t4p::FinderClass::EXACT;
if (findInFiles.Prepare()) {
while (directorySearch.More()) {
directorySearch.Walk(findInFiles);
}
std::vector<wxString> matchedFiles = directorySearch.GetMatchedFiles();
for (size_t i = 0; i < matchedFiles.size(); ++i) {
printf("Found at least one match in file %s.\n", (const char*)matchedFiles[i].ToUTF8());
}
time = wxGetLocalTimeMillis() - time;
printf("time for findInFiles Exact Mode:%ld ms \n", time.ToLong());
} else {
puts("Invalid expression: class Db\n");
}
} else {
printf("Could not open Directory: %s\n", (const char*)DirName.ToAscii());
}
}
示例6: wxGetLocalTimeMillis
/*****************************************************
**
** Painter --- drawMString
**
******************************************************/
void Painter::drawMString( const MRect &r, MString &f, const int& align )
{
#ifdef SHOW_STOP_WATCH
static wxLongLong totaltime = 0;
const wxLongLong starttime = wxGetLocalTimeMillis();
#endif
static int count = 0;
SheetFormatter sfmt;
wxString s;
if ( f.formattedLines.size() == 0 )
{
if ( ! f.isEmpty() && f.size.real() == 0 )
{
s = sfmt.fragment2PlainText( f );
//printf( "Painter::drawMString - old size %f %f\n", f.size.real(), f.size.imag());
f.size = getTextExtent( f );
printf( "Painter::drawMString - size not set #%d contents was %s, size now %f %f\n", count++, str2char( s ), f.size.real(), f.size.imag());
}
drawSingleMStringLine( r, f, align );
//return;
}
else
{
double y0 = r.y;
if ( align & Align::Top )
{
// nothing
}
else if ( align & Align::Bottom )
{
y0 = y0 + r.height - f.size.imag();
}
else // default: align & align::VCenter
{
y0 += .5 * ( r.height - f.size.imag());
}
MRect rect( r.x, y0, r.width, r.height );
int line = 0;
for( list<MString>::iterator iter = f.formattedLines.begin(); iter != f.formattedLines.end(); iter++ )
{
line++;
rect.height = iter->size.imag();
//printf( " --->>> Line %d width %f h %f\n", line, iter->size.real(), iter->size.imag() );
drawSingleMStringLine( rect, *iter, align );
rect.y += rect.height;
}
}
#ifdef SHOW_STOP_WATCH
const wxLongLong duration = wxGetLocalTimeMillis() - starttime;
totaltime += duration;
wxLogMessage( wxString::Format( wxT( "Painter::drawTextFormatted in %ld msec, total %ld" ), duration.ToLong(), totaltime.ToLong() ));
#endif
}
示例7: SendEvent
void GOrgueMidiRecorder::PreconfigureMapping(const wxString& element, bool isNRPN, const wxString& reference)
{
unsigned id = m_Map.GetElementByString(element);
unsigned ref = m_Map.GetElementByString(reference);
for(unsigned i = 0; i < m_Preconfig.size(); i++)
if (m_Preconfig[i].elementID == ref)
{
GOrgueMidiEvent e1;
e1.SetTime(wxGetLocalTimeMillis());
e1.SetMidiType(MIDI_SYSEX_GO_SETUP);
e1.SetKey(id);
e1.SetChannel(m_Preconfig[i].channel);
e1.SetValue(m_Preconfig[i].key);
SendEvent(e1);
midi_map m = m_Preconfig[i];
m.elementID = ref;
if (ref >= m_Mappings.size())
m_Mappings.resize(ref + 1);
m_Mappings[ref] = m;
return;
}
midi_map m;
if (isNRPN)
{
if (m_NextNRPN >= 1 << 18)
return;
m.elementID = ref;
m.channel = 1 + m_NextNRPN / (1 << 14);
m.key = m_NextNRPN % (1 << 14);
m_NextNRPN++;
}
else
{
if (m_NextChannel > 16)
return;
m.elementID = ref;
m.channel = m_NextChannel;
m.key = 0;
m_NextChannel++;
}
m_Preconfig.push_back(m);
GOrgueMidiEvent e1;
e1.SetTime(wxGetLocalTimeMillis());
e1.SetMidiType(MIDI_SYSEX_GO_SETUP);
e1.SetKey(id);
e1.SetChannel(m.channel);
e1.SetValue(m.key);
SendEvent(e1);
if (ref >= m_Mappings.size())
m_Mappings.resize(ref + 1);
m_Mappings[ref] = m;
}
示例8: wxGetLocalTimeMillis
void Export_DLG::Step(const wxString& fname)
{
++pos;
if (next_update_tick < wxGetLocalTimeMillis().GetLo())
{
m_gauge1->SetValue(pos);
m_textCtrl1->SetLabel(fname);
next_update_tick = wxGetLocalTimeMillis().GetLo()+100;
wxGetApp().Yield();
}
}
示例9: printf
/*****************************************************
**
** AtlasImporter --- Destructor
**
******************************************************/
AtlasImporter::~AtlasImporter()
{
sharedSection->threadOrder = THREADORDER_EXIT;
if ( importWorker->IsRunning())
{
printf( "AtlasImportDialog destructor waiting for import worker to join ...\n" );
wxLongLong starttime = wxGetLocalTimeMillis();
importWorker->Wait();
wxLongLong duration = wxGetLocalTimeMillis() - starttime;
printf( "Import worker stopped in %ld milllisec\n", duration.ToLong());
}
delete importWorker;
delete sharedSection;
}
示例10: Tool
FlyTool::FlyTool(View::DocumentViewHolder& documentViewHolder, InputController& inputController) :
Tool(documentViewHolder, inputController, false) {
for (MoveKey::Type i = 0; i < 4; i++)
m_moveKeys[i] = 0;
m_lastUpdateTime = wxGetLocalTimeMillis();
Start(1000 / 60);
}
示例11: DeleteAllItems
void ThreadList::updateThreads(const ProcessInfo* processInfo, SymbolInfo *symInfo)
{
this->selected_threads.clear();
DeleteAllItems();
this->threads.clear();
ok_button->Enable(false);
all_button->Enable(false);
if(processInfo != NULL)
{
this->process_handle = processInfo->getProcessHandle();
this->syminfo = symInfo;
this->threads = processInfo->threads;
int numDisplayedThreads = getNumDisplayedThreads();
for(int i=0; i<numDisplayedThreads; ++i)
{
long tmp = this->InsertItem(i, "", -1);
SetItemData(tmp, i);
}
all_button->Enable(this->threads.size() != 0);
lastTime = wxGetLocalTimeMillis();
updateTimes();
updateSorting();
fillList();
}
}
示例12: WXUNUSED
void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
{
m_pendingRefresh = false;
m_lastRefresh = wxGetLocalTimeMillis();
if( !m_drawing )
{
m_drawing = true;
m_view->UpdateItems();
m_gal->BeginDrawing();
m_gal->ClearScreen( m_painter->GetSettings()->GetBackgroundColor() );
if( m_view->IsDirty() )
{
m_view->ClearTargets();
// Grid has to be redrawn only when the NONCACHED target is redrawn
if( m_view->IsTargetDirty( KIGFX::TARGET_NONCACHED ) )
m_gal->DrawGrid();
m_view->Redraw();
}
m_gal->DrawCursor( m_viewControls->GetCursorPosition() );
m_gal->EndDrawing();
m_drawing = false;
}
}
示例13: wxSortedListCtrl
ThreadList::ThreadList(wxWindow *parent, const wxPoint& pos,
const wxSize& size, wxButton *_ok_button, wxButton *_all_button)
: wxSortedListCtrl(parent, THREADS_LIST, pos, size, wxLC_REPORT),
timer(this, THREADS_LIST_TIMER),
ok_button(_ok_button), all_button(_all_button)
{
InitSort();
wxListItem itemCol;
itemCol.m_mask = wxLIST_MASK_TEXT/* | wxLIST_MASK_IMAGE*/;
itemCol.m_text = _T("Thread");
itemCol.m_image = -1;
InsertColumn(COL_ID, itemCol);
itemCol.m_text = _T("Location");
InsertColumn(COL_LOCATION, itemCol);
itemCol.m_text = _T("Thread Usage");
InsertColumn(COL_CPUUSAGE, itemCol);
SetColumnWidth(COL_ID, 50);
SetColumnWidth(COL_LOCATION, 200);
SetColumnWidth(COL_CPUUSAGE, 120);
sort_column = COL_CPUUSAGE;
sort_dir = SORT_DOWN;
SetSortImage(sort_column, sort_dir);
process_handle = NULL;
syminfo = NULL;
lastTime = wxGetLocalTimeMillis();
updateThreads(NULL, NULL);
timer.Start(UPDATE_DELAY);
}
示例14: wxGetLocalTimeMillis
wxCondError wxConditionInternal::WaitTimeout(unsigned long milliseconds)
{
wxLongLong curtime = wxGetLocalTimeMillis();
curtime += milliseconds;
wxLongLong temp = curtime / 1000;
int sec = temp.GetLo();
temp *= 1000;
temp = curtime - temp;
int millis = temp.GetLo();
timespec tspec;
tspec.tv_sec = sec;
tspec.tv_nsec = millis * 1000L * 1000L;
int err = pthread_cond_timedwait( &m_cond, GetPMutex(), &tspec );
switch ( err )
{
case ETIMEDOUT:
return wxCOND_TIMEOUT;
case 0:
return wxCOND_NO_ERROR;
default:
wxLogApiError(_T("pthread_cond_timedwait()"), err);
}
return wxCOND_MISC_ERROR;
}
示例15: wxGetLocalTimeMillis
void VolumeCreationProgressWizardPage::SetProgressState (bool volumeCreatorRunning)
{
if (volumeCreatorRunning)
StartTime = wxGetLocalTimeMillis();
VolumeCreatorRunning = volumeCreatorRunning;
}