1#![deny(warnings)]
2#![doc(test(attr(deny(warnings))))]
3#![doc(test(attr(allow(dead_code))))]
4#![doc(test(attr(allow(unused_variables))))]
5
6#![no_std]
7
8#[cfg(not(target_os="dos"))]
9mod stub;
10
11#[cfg(not(target_os="dos"))]
12use stub::*;
13
14#[cfg(target_os="dos")]
15mod dos;
16
17#[cfg(target_os="dos")]
18use dos::*;
19
20pub struct Timer(());
21
22impl Timer {
23 pub unsafe fn new(frequency: u16) -> Timer {
28 init(frequency);
29 Timer(())
30 }
31
32 pub fn ticks(&self) -> u64 {
33 unsafe {
34 ticks()
35 }
36 }
37}
38
39impl Drop for Timer {
40 fn drop(&mut self) {
41 unsafe {
42 done();
43 }
44 }
45}