Qn on time() and gmtime()
Posted: Wed Jan 28, 2009 9:18 pm
I'll start by saying I'm currently using no$gba 2.6 for my development and debugging so it's easily possible that this is the culprit but wanted to ask if there's might be any other reason why the following snippet of code always returns the same value no matter how long elapses between times it's called?
If it's just gonna be a no$ issue, sorry for the dumb qn
Code: Select all
int TimeInSeconds(void)
{
time_t unixTime = time(NULL);
struct tm* timeStruct = gmtime((const time_t *)&unixTime);
int seconds = 0;
seconds += timeStruct->tm_hour * 3600;
seconds += timeStruct->tm_min * 60;
seconds += timeStruct->tm_sec;
return seconds;
}