I have the following code:
static void AprsMakeTimeHms(uint8_t* buffer, const uint32_t timestamp)
{
struct tm* timeStruct;
// Extract timestamp
timeStruct = gmtime((long*)×tamp);
// Check if we got a valid time back
if (timeStruct == NULL)
{
printf(“Null ts\r\n”);
sprintf((char*)buffer, “000000h”);
return;
}
// Format buffer
sprintf((char*)buffer, “%2d%2d%2dh”, timeStruct->tm_hour, timeStruct->tm_min, timeStruct->tm_sec);
}
It seems, however, that the struct pointer ends up being assigned NULL. I could swear this was working at some point. Any ideas?