这篇教程C++ ticks函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ticks函数的典型用法代码示例。如果您正苦于以下问题:C++ ticks函数的具体用法?C++ ticks怎么用?C++ ticks使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ticks函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: total_microseconds //! Returns total number of microseconds truncating any sub microsecond values tick_type total_microseconds() const { if (ticks_per_second() < 1000000) { return ticks() * (static_cast<tick_type>(1000000) / ticks_per_second()); } return ticks() / (ticks_per_second() / static_cast<tick_type>(1000000)) ; }
开发者ID:gijs,项目名称:hexer,代码行数:8,
示例2: sntp_processvoid sntp_process( void ){ switch( state ) { case SNTP_NOT_READY: return; // host configuration not finished. case SNTP_IDLE: if (ticks() > next_sync_time) { sntp_send_request(); next_sync_time = ticks() + TIMEOUT; state = SNTP_WAITING_FOR_RESPONSE; } break; case SNTP_WAITING_FOR_RESPONSE: if (ticks() > next_sync_time) { next_sync_time = ticks() + interval; interval *= 2; if (interval > MAX_INTERVAL) interval = MAX_INTERVAL; state = SNTP_IDLE; } }}
开发者ID:chrisforbes,项目名称:ijwrouter,代码行数:27,
示例3: ticksnamespace antares {const ticks kSlowScrollInterval = ticks(4);const ticks kFastScrollInterval = ticks(2);class ScrollTextScreen : public Card { public: ScrollTextScreen(pn::string_view text, int width, ticks interval); ScrollTextScreen(pn::string_view text, int width, ticks interval, pn::string_view song); virtual void become_front(); virtual void resign_front(); virtual void mouse_down(const MouseDownEvent& event); virtual void key_down(const KeyDownEvent& event); virtual void gamepad_button_down(const GamepadButtonDownEvent& event); virtual bool next_timer(wall_time& time); virtual void fire_timer(); virtual void draw() const; private: BuildPix _build_pix; const ticks _interval; const bool _play_song; const pn::string _song; wall_time _start; wall_time _next_shift; int32_t _position;};} // namespace antares
开发者ID:arescentral,项目名称:antares,代码行数:34,
示例4: defined// sleep(int milliseconds) --// -- sleeps during the specified time (in milliseconds)void GOS::sleep(int milliseconds){#if defined(UNIX) struct timeval tv; tv.tv_sec = milliseconds / 1000; tv.tv_usec = (milliseconds - (tv.tv_sec * 1000)) * 1000;# if defined(THREADMODEL) && (THREADMODEL==COTHREADS) GThread::select(0, NULL, NULL, NULL, &tv);# else select(0, NULL, NULL, NULL, &tv);# endif#elif defined(WIN32) Sleep(milliseconds);#elif defined(OS2) DosSleep(milliseconds);#elif defined(macintosh) unsigned long tick = ticks(), now; while (1) { now = ticks(); if ((tick+milliseconds) < now) break; GThread::yield(); }#endif}
开发者ID:serghei,项目名称:kde3-kdegraphics,代码行数:28,
示例5: maxvoid TIME_STEPPER::time_loop() { if (first_step) { REAL OmRMax = 0.0, MaxRadius = 0.0; if (globalSystem->useBodies) { for (int i = 0; i < BODY::AllBodyFaces.size(); ++i) { Vect3 Pos = BODY::AllBodyFaces[i]->CollocationPoint - BODY::AllBodyFaces[i]->Owner->CG; // Get point kinematic velocity - rotational part first Vect3 Vrot = BODY::AllBodyFaces[i]->Owner->BodyRates.Cross(Pos); // Add to translational velocity.... Vect3 Vkin = BODY::AllBodyFaces[i]->Owner->Velocity + Vrot; OmRMax = max(Vkin.Mag(), OmRMax); MaxRadius = max(MaxRadius, Pos.Mag()); } } dt = globalSystem->dtInit;// = cfl_lim/OmRMax; dt_prev = cfl_lim/OmRMax; if (globalSystem->useBodies) { BODY::BodySubStep(globalSystem->dtInit, globalSystem->NumSubSteps); globalSystem->PutWakesInTree(); } globalOctree->Reset(); globalOctree->GetVels(); // if (globalSystem->useFMM) {//#pragma omp parallel for// for (int i = 0; i < FVMCell::AllCells.size(); ++i)// for (int j = 0; j < FVMCell::AllCells.size(); ++j)// FVMCell::AllCells[i]->Velocity += UTIL::globalDirectVel(FVMCell::AllCells[j]->Position - FVMCell::AllCells[i]->Position, FVMCell::AllCells[j]->Omega);// } first_step = false; } else {#ifdef TIME_STEPS long unsigned int t1 = ticks();#endif TimeAdvance(); // Produce Output if (globalTimeStepper->dump_next) { globalSystem->WriteData(); }#ifdef TIME_STEPS long unsigned int t13 = ticks(); stringstream tmp; tmp << "Total....................: " << double(t13 - t1) / 1000.0 << endl; globalIO->step_data += tmp.str();#endif // Display Status globalIO->stat_step(); }}
开发者ID:tommo97,项目名称:Combined,代码行数:58,
示例6: ticksvoid play_controller::init_managers(){ LOG_NG << "initializing managers... " << (SDL_GetTicks() - ticks()) << std::endl; preferences::set_preference_display_settings(); tooltips_manager_.reset(new tooltips::manager(gui_->video())); soundsources_manager_.reset(new soundsource::manager(*gui_)); resources::soundsources = soundsources_manager_.get(); LOG_NG << "done initializing managers... " << (SDL_GetTicks() - ticks()) << std::endl;}
开发者ID:doofus-01,项目名称:wesnoth,代码行数:10,
示例7: mainint main (){ int n = 100, i, ic; double fpi = 3.1415926 / 180.0, step, x; float xray[100], y1ray[100], y2ray[100]; step = 360. / (n - 1); for (i = 0; i < n; i++) { xray[i] = (float) (i * step); x = xray[i] * fpi; y1ray[i] = (float) sin (x); y2ray[i] = (float) cos (x); } metafl ("cons"); scrmod ("revers"); disini (); pagera (); complx (); axspos (450, 1800); axslen (2200, 1200); name ("X-axis", "x"); name ("Y-axis", "y"); labdig (-1, "x"); ticks (9, "x"); ticks (10, "y"); titlin ("Demonstration of CURVE", 1); titlin ("SIN(X), COS(X)", 3); ic = intrgb (0.95,0.95,0.95); axsbgd (ic); graf (0.0, 360.0, 0.0, 90.0, -1.0, 1.0, -1.0, 0.5); setrgb (0.7, 0.7, 0.7); grid (1, 1); color ("fore"); height (50); title (); color ("red"); curve (xray, y1ray, n); color ("green"); curve (xray, y2ray, n); disfin (); return 0;}
开发者ID:galadri3l,项目名称:code,代码行数:50,
示例8: duration_cast int64_t duration_cast() const { const int64_t num = period_type::num * Den; const int64_t den = period_type::den * Num; if (num == 1 && den == 1) return ticks(); else if (num != 1 && den == 1) return ticks() * num; else if (num == 1 && period_type::den != 1) return ticks() / den; else return ticks() * num / den; }
开发者ID:cboulay,项目名称:labstreaminglayer,代码行数:14,
示例9: broadCast/**Sends messages to all clients or to all clients not in a game.*/void broadCast(bool global){ verbose && cout << ticks() << ": server broadcasts: .:" << buffer.str() <<":." << endl; for (Clients::iterator it = clients.begin(); it != clients.end(); it++) if (it->second != 0){ if (it->second && ((global) || (it->second->game == 0))) it->second->cast(); } buffer.str("");}
开发者ID:blaf,项目名称:ditchers,代码行数:10,
示例10: ticks/**Checks whether no OOS occurs.*/bool Game::syncCheck(int clid, int timestamp, int plid, double coordx, double coordy){ synced++; double record = coordx + coordy; int i = 0; for (map<int, Client*>::iterator it = clients.begin(); it != clients.end(); it++){ if (it->second->id == clid){ sync->at(i) += record; break; } i++; } if (synced == clients.size() * players.WrapMap<Player*>::size()){ record = sync->at(0); int i = 0; for (map<int, Client*>::iterator it = clients.begin(); it != clients.end(); it++){ if (record != sync->at(i)){ return false; } sync->at(i) = 0; i++; } synced = 0; verbose && cout << ticks() << ": game #" << id << " sync ok" << endl; } return true;}
开发者ID:blaf,项目名称:ditchers,代码行数:31,
示例11: ticksvoid playsingle_controller::init_gui(){ LOG_NG << "Initializing GUI... " << (SDL_GetTicks() - ticks()) << "/n"; play_controller::init_gui(); // Scroll to the starting position of the first team. If there is a // human team, use that team; otherwise use team 1. If the map defines // a starting position for the selected team, scroll to that tile. Note // this often does not matter since many scenario start with messages, // which will usually scroll to the speaker. Also note that the map // does not necessarily define the starting positions. While usually // best to use the map, the scenarion may explicitly set the positions, // overriding those found in the map (if any). { int scroll_team = gamestate().first_human_team_ + 1; if (scroll_team == 0) { scroll_team = 1; } map_location loc(gamestate().board_.map().starting_position(scroll_team)); if ((loc.x >= 0) && (loc.y >= 0)) { gui_->scroll_to_tile(loc, game_display::WARP); } } update_locker lock_display(gui_->video(), is_skipping_replay()); gui_->draw(); get_hotkey_command_executor()->set_button_state(); events::raise_draw_event();}
开发者ID:Wedge009,项目名称:wesnoth,代码行数:28,
示例12: assertvoid dot_t::extend_duration( int extra_ticks, bool cap ){ if ( ! ticking ) return; // Make sure this DoT is still ticking...... assert( tick_event ); if ( sim -> log ) log_t::output( sim, "%s extends duration of %s on %s, adding %d tick(s), totalling %d ticks", action -> player -> name(), name(), player -> name(), extra_ticks, num_ticks + extra_ticks ); if ( cap ) { // Can't extend beyond initial duration. // Assuming this limit is based on current haste, not haste at previous application/extension/refresh. int max_extra_ticks = std::max( action -> hasted_num_ticks() - ticks(), 0 ); extra_ticks = std::min( extra_ticks, max_extra_ticks ); } action -> player_buff(); added_ticks += extra_ticks; num_ticks += extra_ticks; recalculate_ready();}
开发者ID:coleb,项目名称:Raid-Sim,代码行数:27,
示例13: ticksjlong elapsedTimer::active_ticks() const { if (!_active) { return ticks(); } jlong counter = _counter + os::elapsed_counter() - _start_counter; return counter;}
开发者ID:tetratec,项目名称:Runescape-Launcher,代码行数:7,
示例14: mainint main(int argc, char** argv){ uint64_t t1, t2; t1 = ticks(); for (int i = 0; i < 10000000; i++) xorshift128plus(); t2 = ticks(); printf("%ld ms/n", t2 - t1);#ifdef WIN64 printf("state0 = %llu/n", state0); printf("state1 = %llu/n", state1);#else printf("state0 = %lu/n", state0); printf("state1 = %lu/n", state1);#endif}
开发者ID:e42s,项目名称:feline,代码行数:16,
示例15: Game/**Adds a game to the list.*/Game* Games::add(){ Game* newG = new Game(); if (WrapMap<Game*>::add(newG) != 0){ mute || cout << ticks() << ": game #" << newG->id << " created" << endl; return(newG); }else{ free(newG); return 0; }}
开发者ID:blaf,项目名称:ditchers,代码行数:13,
示例16: randominitvoidrandominit(void){#ifdef USE_RANDOM srandom(getpid()+fastticks(nil)+ticks());#else if((randfd = open("/dev/urandom", OREAD)) < 0) if((randfd = open("/dev/random", OREAD)) < 0) panic("open /dev/random: %r");#endif}
开发者ID:npe9,项目名称:harvey,代码行数:11,
示例17: timesinline clock_t times(struct tms *t){ struct timespec ts; clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); clock_t ticks(static_cast<clock_t>(static_cast<double>(ts.tv_sec) * CLOCKS_PER_SEC + static_cast<double>(ts.tv_nsec) * CLOCKS_PER_SEC / 1000000.0)); t->tms_utime = ticks/2U; t->tms_stime = ticks/2U; t->tms_cutime = 0; // vxWorks is lacking the concept of a child process! t->tms_cstime = 0; // -> Set the wait times for childs to 0 return ticks;}
开发者ID:ngzHappy,项目名称:cpc2,代码行数:11,
示例18: duration_cast int64_t duration_cast() const { const int64_t num1 = period_type::num / gcd<period_type::num, Num>::value; const int64_t num2 = Num / gcd<period_type::num, Num>::value; const int64_t den1 = period_type::den / gcd<period_type::den, Den>::value; const int64_t den2 = Den / gcd<period_type::den, Den>::value; const int64_t num = num1 * den2; const int64_t den = num2 * den1; if (num == 1 && den == 1) return ticks(); else if (num != 1 && den == 1) return ticks() * num; else if (num == 1 && period_type::den != 1) return ticks() / den; else return ticks() * num / den; }
开发者ID:ArthurHenriqueDellaFraga,项目名称:INE5426.Compiladores,代码行数:20,
示例19: minimizeNumberOfRestsvoid minimizeNumberOfRests( std::multimap<ReducedFraction, MidiChord> &chords, const TimeSigMap *sigmap, const std::multimap<ReducedFraction, MidiTuplet::TupletData> &tuplets) { for (auto it = chords.begin(); it != chords.end(); ++it) { for (MidiNote ¬e: it->second.notes) { const auto barStart = MidiBar::findBarStart(note.offTime, sigmap); const auto barFraction = ReducedFraction( sigmap->timesig(barStart.ticks()).timesig()); auto durationStart = (it->first > barStart) ? it->first : barStart; if (it->second.isInTuplet) { const auto &tuplet = it->second.tuplet->second; if (note.offTime >= tuplet.onTime + tuplet.len) durationStart = tuplet.onTime + tuplet.len; } auto endTime = (barStart == note.offTime) ? barStart : barStart + barFraction; if (note.isInTuplet) { const auto &tuplet = note.tuplet->second; if (note.offTime == tuplet.onTime + tuplet.len) continue; endTime = barStart + Quantize::quantizeToLarge( note.offTime - barStart, tuplet.len / tuplet.tupletNumber); } const auto beatLen = Meter::beatLength(barFraction); const auto beatTime = barStart + Quantize::quantizeToLarge( note.offTime - barStart, beatLen); if (endTime > beatTime) endTime = beatTime; auto next = std::next(it); while (next != chords.end() && (next->second.voice != it->second.voice || next->first < note.offTime)) { ++next; } if (next != chords.end()) { if (next->first < endTime) endTime = next->first; if (next->second.isInTuplet && !note.isInTuplet) { const auto &tuplet = next->second.tuplet->second; if (tuplet.onTime < endTime) endTime = tuplet.onTime; } } lengthenNote(note, it->second.voice, it->first, durationStart, endTime, barStart, barFraction, tuplets); } } }
开发者ID:DannyBehar,项目名称:MuseScore,代码行数:53,
示例20: ticksbool Timer::stepCount() { Uint32 temp = ticks(); if ( temp < elapsedCount ) { step++; } else { countStep = step; step = 0; start(); return true; } return false;}
开发者ID:EduardoPagotto,项目名称:ChimeraEngine,代码行数:14,
示例21: ticksTIME_STEPPER::TIME_STEPPER() { dt_prev = 0.0; dx = dy = dz = 1.0; ChangeOver = last_step = PruneNow = false; n = -1; RKStep = 0; t = substep_time = sim_time = 0.0; cfl_lim = 0.4; t_out = TIME_STEPPER::dt_out; lambda = mu = nu = 0.0; cpu_t = ticks(); dump_next = show_rundata = false; first_step = dump_next = true;}
开发者ID:tommo97,项目名称:Combined,代码行数:14,
示例22: ticksvoid playsingle_controller::init_gui(){ LOG_NG << "Initializing GUI... " << (SDL_GetTicks() - ticks()) << "/n"; play_controller::init_gui(); if(gamestate().first_human_team_ != -1) { gui_->scroll_to_tile(gamestate().board_.map().starting_position(gamestate().first_human_team_ + 1), game_display::WARP); } gui_->scroll_to_tile(gamestate().board_.map().starting_position(1), game_display::WARP); update_locker lock_display(gui_->video(), is_skipping_replay()); gui_->draw(); get_hotkey_command_executor()->set_button_state(); events::raise_draw_event();}
开发者ID:quyetdx55,项目名称:wesnoth,代码行数:14,
示例23: newID/**Adds a client to the list.*/bool Clients::add(TCPsocket newsd){ int newid = newID(); if (newid != 0){ //modified = true; Client* cl = new Client(newsd); operator[](newid) = cl; cl->id = newid; cl->state = cl->CHOOSE; mute || cout << ticks() << ": client #" << newid << " joined" << endl; }; return newid;}
开发者ID:blaf,项目名称:ditchers,代码行数:18,
示例24: ticksvoid PhysicsSim::updatePhysics(){ u32 TDeltaTime = ticks(); if(paused) TDeltaTime = 0; //if(!paused) //{ dynamicsWorld->stepSimulation(TDeltaTime * 0.001f, 60); for(unsigned int i = 0; i < objects_list.size(); i++) objects_list[i]->Update(); //}}
开发者ID:mikeiasNS,项目名称:SnowHero-irrlich-Game-,代码行数:15,
示例25: dateTime::Time(ptime t){ auto datePart = t.date(); auto timePart = t.time_of_day(); TimeScale timeScale = TimeScale::Master(); // consider date part only auto d = datePart - date(1970, 1, 1); int offsetFromEpochDays = d.days(); this->ticks_ = timeScale.TicksPerDay() * offsetFromEpochDays; // add ticks for time of day if(time_duration::ticks_per_second() > timeScale.TicksPerSecond()) // since the following computations are integer calculcations, we distinguish here { int64 conversionRate = time_duration::ticks_per_second() / timeScale.TicksPerSecond(); this->ticks_ += timePart.ticks() / conversionRate; } else { int64 conversionRate = timeScale.TicksPerSecond() / time_duration::ticks_per_second(); this->ticks_ += timePart.ticks() * conversionRate; } }
开发者ID:jackchang,项目名称:TeaFiles.Cpp,代码行数:24,
示例26: tracevoid trace(uint16_t level, const char *msg, ...) { va_list args; va_start(args, msg); if (trace_stream != 0 && trace_level <= level) { // send the timestamp stream_printf(trace_stream, "%ld %s ", ticks(), levels[level]); // send the level stream_vprintf(trace_stream, msg, args); stream_puts(trace_stream, "/r/n"); } platform_trace(level, msg, args); }
开发者ID:kotuku-aero,项目名称:diy-efis,代码行数:16,
示例27: mainint main(int argc, char *argv[]){ std::cout << "Styled text inset demo" << std::endl; QApplication a(argc, argv); WPlot::CartesianPlot2D* plot2D(new WPlot::CartesianPlot2D); WPlot::Ticks2D::Ptr ticks(new WPlot::Ticks2D); WPlot::Axes2D::Ptr axes(new WPlot::Axes2D); ticks->setOrigin(150.0, 200.0); ticks->setPrimaryTickLength(20); ticks->setEnableLabels(true); axes->setTicks(ticks); plot2D->setPadding(25, WPlot::Padding::PIXELS); plot2D->setPlotLimits(-3.3, 7.5, -2, 4.3); plot2D->addAxes(axes); plot2D->show(); return a.exec();}
开发者ID:jepessen,项目名称:wplot,代码行数:17,
注:本文中的ticks函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ticks_per_second函数代码示例 C++ tick_timer_service_unsubscribe函数代码示例 |