I am using a thingy:91 device. I am basically just attempting to write a method that will just wait for a certain amount of seconds (ie: 10 or longer). This is my code below, however, when it runs, time(NULL) and time(0) return a value of -1, and therefore doesn't really work. Does anyone have any ideas to help me along? I'm not really sure why this isn't working. I have tried to use the date_time.h and the time.h libraries. Just for the record, this builds perfectly in SES.
#include <time.h>
:
void waitFor (unsigned int secs) {
unsigned int retTime = time(0) + secs; // Get finishing time.
while (time(0) < retTime); // Loop until it arrives.
}