Groppe
Groppe

Reputation: 3879

How do I set an alarm in Linux for less than a second?

I have been using the alarm() system call and an alarm handler in my c program. Recently I decided that I wanted to set the alarm for a time less than a second, so I passed it 0.5, and discovered that the alarm() function accepts an unsigned int. Is it possible to set an alarm for less than a second?

Upvotes: 3

Views: 1366

Answers (1)

Java42
Java42

Reputation: 7716

Use the ualarm(usecs, interval) method instead.

Upvotes: 4

Related Questions