本文整理汇总了C++中attotime类的典型用法代码示例。如果您正苦于以下问题:C++ attotime类的具体用法?C++ attotime怎么用?C++ attotime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了attotime类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: tts
std::string mfm_harddisk_device::tts(const attotime &t)
{
char buf[256];
int nsec = t.attoseconds() / ATTOSECONDS_PER_NANOSECOND;
sprintf(buf, "%4d.%03d,%03d,%03d", int(t.seconds()), nsec/1000000, (nsec/1000)%1000, nsec % 1000);
return buf;
}
开发者ID:JensGrabner,项目名称:mame,代码行数:7,代码来源:mfmhd.c
示例2: fprintf
int fdc_pll_t::feed_read_data(attotime &tm, const attotime& edge, const attotime &limit)
{
attotime next = ctime + period + phase_adjust;
#if 0
if(!edge.is_never())
fprintf(stderr, "ctime=%s, transition_time=%s, next=%s, pha=%s\n", tts(ctime).c_str(), tts(edge).c_str(), tts(next).c_str(), tts(phase_adjust).c_str());
#endif
if(next > limit)
return -1;
ctime = next;
tm = next;
if(edge.is_never() || edge > next) {
// No transition in the window means 0 and pll in free run mode
phase_adjust = attotime::zero;
return 0;
}
// Transition in the window means 1, and the pll is adjusted
attotime delta = edge - (next - period/2);
if(delta.seconds() < 0)
phase_adjust = attotime::zero - ((attotime::zero - delta)*65)/100;
else
phase_adjust = (delta*65)/100;
if(delta < attotime::zero) {
if(freq_hist < 0)
freq_hist--;
else
freq_hist = -1;
} else if(delta > attotime::zero) {
if(freq_hist > 0)
freq_hist++;
else
freq_hist = 1;
} else
freq_hist = 0;
if(freq_hist) {
int afh = freq_hist < 0 ? -freq_hist : freq_hist;
if(afh > 1) {
attotime aper = attotime::from_double(period_adjust_base.as_double()*delta.as_double()/period.as_double());
period += aper;
if(period < min_period)
period = min_period;
else if(period > max_period)
period = max_period;
}
}
return 1;
}
开发者ID:MASHinfo,项目名称:mame,代码行数:58,代码来源:fdc_pll.cpp
示例3: tts
std::string fdc_pll_t::tts(attotime t)
{
char buf[256];
bool neg = t.seconds() < 0;
if(neg)
t = attotime::zero - t;
int nsec = t.attoseconds() / ATTOSECONDS_PER_NANOSECOND;
sprintf(buf, "%c%3d.%03d,%03d,%03d", neg ? '-' : ' ', int(t.seconds()), nsec/1000000, (nsec/1000)%1000, nsec % 1000);
return buf;
}
开发者ID:MASHinfo,项目名称:mame,代码行数:10,代码来源:fdc_pll.cpp
示例4: machine
void emu_timer::adjust(attotime start_delay, INT32 param, const attotime &period)
{
// if this is the callback timer, mark it modified
device_scheduler &scheduler = machine().scheduler();
if (scheduler.m_callback_timer == this)
scheduler.m_callback_timer_modified = true;
// compute the time of the next firing and insert into the list
m_param = param;
m_enabled = true;
// clamp negative times to 0
if (start_delay.seconds() < 0)
start_delay = attotime::zero;
// set the start and expire times
m_start = scheduler.time();
m_expire = m_start + start_delay;
m_period = period;
// remove and re-insert the timer in its new order
scheduler.timer_list_remove(*this);
scheduler.timer_list_insert(*this);
// if this was inserted as the head, abort the current timeslice and resync
if (this == scheduler.first_timer())
scheduler.abort_timeslice();
}
开发者ID:WinCoder,项目名称:mame,代码行数:28,代码来源:schedule.cpp
示例5: sync_separator
int fixedfreq_device::sync_separator(attotime time, double newval)
{
int last_vsync = m_sig_vsync;
int last_comp = m_sig_composite;
int ret = 0;
m_vint += ((double) last_comp - m_vint) * (1.0 - exp(-time.as_double() * m_mult));
m_sig_composite = (newval < m_sync_threshold) ? 1 : 0 ;
m_sig_vsync = (m_vint > m_int_trig) ? 1 : 0;
if (!last_vsync && m_sig_vsync)
{
/* TODO - time since last hsync and field detection */
ret |= 1;
}
if (last_vsync && !m_sig_vsync)
{
m_sig_field = last_comp; /* force false-progressive */
m_sig_field = (m_sig_field ^ 1) ^ last_comp; /* if there is no field switch, auto switch */
VERBOSE_OUT(("Field: %d\n", m_sig_field));
}
if (!last_comp && m_sig_composite)
{
/* TODO - time since last hsync and field detection */
ret |= 2;
}
if (last_comp && !m_sig_composite)
{
/* falling composite */
ret |= 4;
}
return ret;
}
开发者ID:felipesanches,项目名称:ume,代码行数:34,代码来源:fixfreq.c
示例6: osd_ticks
void video_manager::recompute_speed(const attotime &emutime)
{
// if we don't have a starting time yet, or if we're paused, reset our starting point
if (m_speed_last_realtime == 0 || machine().paused())
{
m_speed_last_realtime = osd_ticks();
m_speed_last_emutime = emutime;
}
// if it has been more than the update interval, update the time
attotime delta_emutime = emutime - m_speed_last_emutime;
if (delta_emutime > attotime(0, ATTOSECONDS_PER_SPEED_UPDATE))
{
// convert from ticks to attoseconds
osd_ticks_t realtime = osd_ticks();
osd_ticks_t delta_realtime = realtime - m_speed_last_realtime;
osd_ticks_t tps = osd_ticks_per_second();
m_speed_percent = delta_emutime.as_double() * (double)tps / (double)delta_realtime;
// remember the last times
m_speed_last_realtime = realtime;
m_speed_last_emutime = emutime;
// if we're throttled, this time period counts for overall speed; otherwise, we reset the counter
if (!m_fastforward)
m_overall_valid_counter++;
else
m_overall_valid_counter = 0;
// if we've had at least 4 consecutive valid periods, accumulate stats
if (m_overall_valid_counter >= 4)
{
m_overall_real_ticks += delta_realtime;
while (m_overall_real_ticks >= tps)
{
m_overall_real_ticks -= tps;
m_overall_real_seconds++;
}
m_overall_emutime += delta_emutime;
}
}
// if we're past the "time-to-execute" requested, signal an exit
if (m_seconds_to_run != 0 && emutime.seconds() >= m_seconds_to_run)
{
screen_device *screen = machine().first_screen();
if (screen != nullptr)
{
// create a final screenshot
emu_file file(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
osd_file::error filerr = file.open(machine().basename(), PATH_SEPARATOR "final.png");
if (filerr == osd_file::error::NONE)
save_snapshot(screen, file);
}
//printf("Scheduled exit at %f\n", emutime.as_double());
// schedule our demise
machine().schedule_exit();
}
}
开发者ID:kaspal,项目名称:mame,代码行数:59,代码来源:video.cpp
示例7:
void c64h156_device::commit(const attotime &tm)
{
if(cur_live.write_start_time.is_never() || tm == cur_live.write_start_time || !cur_live.write_position)
return;
if (LOG) logerror("%s committing %u transitions since %s\n", tm.as_string(), cur_live.write_position, cur_live.write_start_time.as_string());
m_floppy->write_flux(cur_live.write_start_time, tm, cur_live.write_position, cur_live.write_buffer);
cur_live.write_start_time = tm;
cur_live.write_position = 0;
}
开发者ID:ef1105,项目名称:mameplus,代码行数:12,代码来源:64h156.c
示例8: TEST_CASE
#include "catch.hpp"
#include "emucore.h"
#include "eminline.h"
#include "attotime.h"
TEST_CASE("convert 1 sec to attotime", "[emu]")
{
attotime value = attotime::from_seconds(1);
REQUIRE(value.as_attoseconds() == 1000000000000000000);
}
开发者ID:MASHinfo,项目名称:mame,代码行数:11,代码来源:attotime.cpp
示例9: calc_plunger_pos
double mgolf_state::calc_plunger_pos()
{
return (machine().time().as_double() - m_time_released.as_double()) * (m_time_released.as_double() - m_time_pushed.as_double() + 0.2);
}
开发者ID:hstampfl,项目名称:mame,代码行数:4,代码来源:mgolf.c
示例10: run_test
static messtest_result_t run_test(int flags, messtest_results *results)
{
const game_driver *driver;
messtest_result_t rc;
clock_t begin_time;
double real_run_time;
astring *fullpath = NULL;
const char *device_opt;
const char *fake_argv[2];
core_options *opts;
/* lookup driver */
driver = driver_get_name(current_testcase.driver);
/* cannot find driver? */
if (driver == NULL)
{
report_message(MSG_FAILURE, "Cannot find driver '%s'", current_testcase.driver);
return MESSTEST_RESULT_STARTFAILURE;
}
/* prepare testing state */
current_command = current_testcase.commands;
state = STATE_READY;
test_flags = flags;
screenshot_num = 0;
runtime_hash = 0;
had_failure = FALSE;
//videoram = NULL;
//videoram_size = 0;
/* set up options */
opts = mame_options_init(win_mess_opts);
options_set_string(opts, OPTION_GAMENAME, driver->name, OPTION_PRIORITY_CMDLINE);
if( current_testcase.bios )
options_set_string(opts, OPTION_BIOS, current_testcase.bios, OPTION_PRIORITY_CMDLINE);
options_set_bool(opts, OPTION_SKIP_GAMEINFO, TRUE, OPTION_PRIORITY_CMDLINE);
options_set_bool(opts, OPTION_THROTTLE, FALSE, OPTION_PRIORITY_CMDLINE);
options_set_bool(opts, OPTION_DEBUG, FALSE, OPTION_PRIORITY_CMDLINE);
options_set_bool(opts, OPTION_DEBUG_INTERNAL, FALSE, OPTION_PRIORITY_CMDLINE);
options_set_bool(opts, OPTION_WRITECONFIG, FALSE, OPTION_PRIORITY_CMDLINE);
if (current_testcase.ram != 0)
{
options_set_int(opts, OPTION_RAMSIZE, current_testcase.ram, OPTION_PRIORITY_CMDLINE);
}
/* ugh... hideous ugly fake arguments */
fake_argv[0] = "MESSTEST";
fake_argv[1] = driver->name;
options_parse_command_line(opts, ARRAY_LENGTH(fake_argv), (char **) fake_argv, OPTION_PRIORITY_CMDLINE,TRUE);
/* preload any needed images */
while(current_command->command_type == MESSTEST_COMMAND_IMAGE_PRELOAD)
{
/* get the path */
fullpath = assemble_software_path(astring_alloc(), driver, current_command->u.image_args.filename);
/* get the option name */
device_opt = device_config_image_interface::device_typename(current_command->u.image_args.device_ident.type);
/* set the option */
options_set_string(opts, device_opt, astring_c(fullpath), OPTION_PRIORITY_CMDLINE);
/* cleanup */
astring_free(fullpath);
fullpath = NULL;
/* next command */
current_command++;
}
/* perform the test */
report_message(MSG_INFO, "Beginning test (driver '%s')", current_testcase.driver);
begin_time = clock();
mame_set_output_channel(OUTPUT_CHANNEL_ERROR, messtest_output_error, NULL, NULL, NULL);
mame_set_output_channel(OUTPUT_CHANNEL_WARNING, mame_null_output_callback, NULL, NULL, NULL);
mame_set_output_channel(OUTPUT_CHANNEL_INFO, mame_null_output_callback, NULL, NULL, NULL);
mame_set_output_channel(OUTPUT_CHANNEL_DEBUG, mame_null_output_callback, NULL, NULL, NULL);
mame_set_output_channel(OUTPUT_CHANNEL_LOG, mame_null_output_callback, NULL, NULL, NULL);
test_osd_interface osd;
mame_execute(osd, opts);
real_run_time = ((double) (clock() - begin_time)) / CLOCKS_PER_SEC;
/* what happened? */
switch(state)
{
case STATE_ABORTED:
report_message(MSG_FAILURE, "Test aborted");
rc = MESSTEST_RESULT_RUNTIMEFAILURE;
break;
case STATE_DONE:
if (had_failure)
{
report_message(MSG_FAILURE, "Test failed (real time %.2f; emu time %.2f [%i%%])",
real_run_time, final_time.as_double(), (int) ((final_time.as_double() / real_run_time) * 100));
rc = MESSTEST_RESULT_RUNTIMEFAILURE;
}
else
//.........这里部分代码省略.........
开发者ID:rogerjowett,项目名称:ClientServerMAME,代码行数:101,代码来源:testmess.c
注:本文中的attotime类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论