What is the easiest and simplest way to create a decrementing timer in seconds?
Im using an 8bit microcontroller and cannot use float points or intensive processes. I need a very efficient timer.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
time(2)is a standard C function for obtaining the current time in seconds since the epoch (midnight on January 1, 1970 UTC). To make a decrementing timer, you could do something like this:If you need more precision than 1-second increments, you can use a platform-specific function such as
gettimeofday(3)(POSIX) orGetLocalTime(Windows).