Qn on time() and gmtime()

Post Reply
Pete
Posts: 18
Joined: Wed Jan 28, 2009 9:12 pm

Qn on time() and gmtime()

Post by Pete » 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?

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;
}
If it's just gonna be a no$ issue, sorry for the dumb qn :oops:

eKid
Posts: 65
Joined: Sat Dec 06, 2008 6:07 pm
Contact:

Re: Qn on time() and gmtime()

Post by eKid » Thu Jan 29, 2009 12:25 pm

Test on hardware. :)

I think only the latest no$gba version has time support, but it doesn't seem to be available anymore... :/

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 5 guests