diff options
author | 2011-02-03 07:52:45 +0000 | |
---|---|---|
committer | 2011-02-03 07:52:45 +0000 | |
commit | 1e88333178b63ee0d5b914e181b19b3b161f807b (patch) | |
tree | ff1d59069ab151d3ea122c8a26931305157f9d17 /src/emu/imagedev | |
parent | 78005b8ffeaf34d10565466d794debf7f5d2ff73 (diff) |
Converted attotime to a class, with proper operators. Removed old
global functions which are now superceded by the operators and
methods on the class. [Aaron Giles]
Required mappings are:
attotime_make(a,b) => attotime(a,b)
attotime_to_double(t) => t.as_double()
double_to_attotime(d) => attotime::from_double(d)
attotime_to_attoseconds(t) => t.as_attoseconds()
attotime_to_ticks(t,f) => t.as_ticks(f)
ticks_to_attotime(t,f) => attotime::from_ticks(t,f)
attotime_add(a,b) => a + b
attotime_add_attoseconds(a,b) => a + attotime(0, b)
attotime_sub(a,b) => a - b
attotime_sub_attoseconds(a,b) => a - attotime(0, b)
attotime_compare(a,b) == 0 => a == b
attotime_compare(a,b) != 0 => a != b
attotime_compare(a,b) < 0 => a < b
attotime_compare(a,b) <= 0 => a <= b
attotime_compare(a,b) > 0 => a > b
attotime_compare(a,b) >= 0 => a >= b
attotime_mul(a,f) => a * f
attotime_div(a,f) => a / f
attotime_min(a,b) => min(a,b)
attotime_max(a,b) => max(a,b)
attotime_is_never(t) => t.is_never()
attotime_string(t,p) => t.as_string(p)
In addition, some existing #defines still exist but will go away:
attotime_zero => attotime::zero
attotime_never => attotime::never
ATTOTIME_IN_SEC(s) => attotime::from_seconds(s)
ATTOTIME_IN_MSEC(m) => attotime::from_msec(m)
ATTOTIME_IN_USEC(u) => attotime::from_usec(u)
ATTOTIME_IN_NSEC(n) => attotime::from_nsec(n)
ATTOTIME_IN_HZ(h) => attotime::from_hz(h)
Diffstat (limited to 'src/emu/imagedev')
-rw-r--r-- | src/emu/imagedev/bitbngr.c | 6 | ||||
-rw-r--r-- | src/emu/imagedev/cassette.c | 6 | ||||
-rw-r--r-- | src/emu/imagedev/flopdrv.c | 4 | ||||
-rw-r--r-- | src/emu/imagedev/snapquik.c | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/src/emu/imagedev/bitbngr.c b/src/emu/imagedev/bitbngr.c index a0c3651f18f..0482f73868b 100644 --- a/src/emu/imagedev/bitbngr.c +++ b/src/emu/imagedev/bitbngr.c @@ -409,7 +409,7 @@ static TIMER_CALLBACK(bitbanger_input_timer) if(bi->input_buffer_size == 0) { /* no more data, wait and try again */ - bi->idle_delay = attotime_min(attotime_add(bi->idle_delay, ATTOTIME_IN_MSEC(100)), ATTOTIME_IN_SEC(1)); + bi->idle_delay = min(bi->idle_delay + attotime::from_msec(100), attotime::from_seconds(1)); timer_adjust_oneshot(bi->bitbanger_input_timer, bi->idle_delay, 0); @@ -449,11 +449,11 @@ void bitbanger_output(device_t *device, int value) bi->build_count = 9; bi->build_byte = 0; - one_point_five_baud = attotime_add(bi->current_baud, attotime_div(bi->current_baud,2)); + one_point_five_baud = bi->current_baud + bi->current_baud / 2; timer_adjust_periodic(bi->bitbanger_output_timer, one_point_five_baud, 0, bi->current_baud); } - //fprintf(stderr,"%s, %d\n", attotime_string(timer_get_time(device->machine),9), value); + //fprintf(stderr,"%s, %d\n", timer_get_time(device->machine).as_string(9), value); bi->output_value = value; } diff --git a/src/emu/imagedev/cassette.c b/src/emu/imagedev/cassette.c index ec2018efa81..294f90eecca 100644 --- a/src/emu/imagedev/cassette.c +++ b/src/emu/imagedev/cassette.c @@ -71,7 +71,7 @@ INLINE int cassette_is_motor_on(device_t *device) static void cassette_update(device_t *device) { dev_cassette_t *cassette = get_safe_token( device ); - double cur_time = attotime_to_double(timer_get_time(device->machine)); + double cur_time = timer_get_time(device->machine).as_double(); if (cassette_is_motor_on(device)) { @@ -187,7 +187,7 @@ double cassette_get_position(device_t *device) position = cassette->position; if (cassette_is_motor_on(device)) - position += attotime_to_double(timer_get_time(device->machine)) - cassette->position_time; + position += timer_get_time(device->machine).as_double() - cassette->position_time; return position; } @@ -302,7 +302,7 @@ static DEVICE_IMAGE_LOAD( cassette ) /* reset the position */ cassette->position = 0.0; - cassette->position_time = attotime_to_double(timer_get_time(device->machine)); + cassette->position_time = timer_get_time(device->machine).as_double(); return IMAGE_INIT_PASS; diff --git a/src/emu/imagedev/flopdrv.c b/src/emu/imagedev/flopdrv.c index 8295839a1df..6f22d8dea71 100644 --- a/src/emu/imagedev/flopdrv.c +++ b/src/emu/imagedev/flopdrv.c @@ -244,12 +244,12 @@ static void floppy_drive_index_func(device_t *img) if (drive->idx) { drive->idx = 0; - timer_adjust_oneshot((emu_timer*)drive->index_timer, double_to_attotime(ms*19/20/1000.0), 0); + timer_adjust_oneshot((emu_timer*)drive->index_timer, attotime::from_double(ms*19/20/1000.0), 0); } else { drive->idx = 1; - timer_adjust_oneshot((emu_timer*)drive->index_timer, double_to_attotime(ms/20/1000.0), 0); + timer_adjust_oneshot((emu_timer*)drive->index_timer, attotime::from_double(ms/20/1000.0), 0); } devcb_call_write_line(&drive->out_idx_func, drive->idx); diff --git a/src/emu/imagedev/snapquik.c b/src/emu/imagedev/snapquik.c index 460f2455cb9..804a9ac0107 100644 --- a/src/emu/imagedev/snapquik.c +++ b/src/emu/imagedev/snapquik.c @@ -153,7 +153,7 @@ static DEVICE_IMAGE_LOAD( snapquick ) /* adjust the timer */ timer_adjust_oneshot( token->timer, - attotime_make(config->delay_seconds, config->delay_attoseconds), + attotime(config->delay_seconds, config->delay_attoseconds), 0); return IMAGE_INIT_PASS; |