How do I make sleep/wait on Rust without std?

Viewed 428

I'm trying to make OS that does VGA text animation thing, but it's really fast as it processes as fast as it can.

So I wanna make the "wait" function and wait like 100ms each motions but I have no idea how to make it without using std crate.

So the question, how do I make sleep/wait on Rust without std?

Thanks

1 Answers

You can read the processor clock with the rdtsc instruction and do a hlt loop until the required time passes. Or you can read the CMOS clock, but that will only have a second resolution.

Related