diff options
author | 2011-10-01 00:52:36 +0000 | |
---|---|---|
committer | 2011-10-01 00:52:36 +0000 | |
commit | b4d32e1285e7af4de0b0126965c84e0e434826af (patch) | |
tree | b112c7a3c167b4a692debaeb4d2cc749c0fdfa2e /src/emu | |
parent | 155da9fa6bef04469acdf36eba2429b5c4524b44 (diff) |
allow small freqs for from_hz
Diffstat (limited to 'src/emu')
-rw-r--r-- | src/emu/attotime.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/emu/attotime.h b/src/emu/attotime.h index 2440ff7c90a..69421423b94 100644 --- a/src/emu/attotime.h +++ b/src/emu/attotime.h @@ -143,7 +143,7 @@ public: static attotime from_msec(INT64 msec) { return attotime(msec / 1000, (msec % 1000) * (ATTOSECONDS_PER_SECOND / 1000)); } static attotime from_usec(INT64 usec) { return attotime(usec / 1000000, (usec % 1000000) * (ATTOSECONDS_PER_SECOND / 1000000)); } static attotime from_nsec(INT64 nsec) { return attotime(nsec / 1000000000, (nsec % 1000000000) * (ATTOSECONDS_PER_SECOND / 1000000000)); } - static attotime from_hz(double frequency) { assert(frequency >= 1); return attotime(0, double(ATTOSECONDS_PER_SECOND) / frequency); } + static attotime from_hz(double frequency) { assert(frequency > 0); double d = 1 / frequency; return attotime(floor(d), modf(d, &d) * ATTOSECONDS_PER_SECOND); } // math attotime &operator+=(const attotime &right); |