I'm building my own unix time to human readable conversion, and I'm stuck.
I can extract the year just fine, but the day is proving too tricky.
/*
Converts a 32-bit number of seconds after 01-01-1970 to a _SYSTEMTIME structure
*/
static _SYSTEMTIME Convert(unsigned long a_UnixTime)
{
newtime.wMilliseconds = 0;
newtime.wYear = (unsigned long)((float)a_UnixTime / (364.24f * 24.f * 60.f * 60.f));
newtime.wDay = (a_UnixTime - (unsigned long)((float)newtime.wYear * 364.24f * 24.f * 60.f * 60.f)); // returns 65177
return newtime;
}
Or is there a built-in function that I've overlooked?
Thanks in advance.
UPDATE:
Hmm... it seems Windows Mobile doesn't support strftime, time or localtime, so I'll still have to roll my own. :(