gmtime() returns null

Sysprogs forums Forums VisualGDB gmtime() returns null

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #21415
    chris1seto
    Participant

    I have the following code:

    static void AprsMakeTimeHms(uint8_t* buffer, const uint32_t timestamp)
    {
    struct tm* timeStruct;

    // Extract timestamp
    timeStruct = gmtime((long*)&timestamp);

    // 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?

    #21416
    support
    Keymaster

    Hi,

    Sorry, this doesn’t look like a VisualGDB-related issue, so we are not able to provide much help with this. The best advice we could give would be to look through the source code of your C library or asking on StackOverflow.

    #21417
    chris1seto
    Participant

    Figured it out.

     

    Need to make sure this is configured like so:

     

    Attachments:
    You must be logged in to view attached files.
    #21420
    support
    Keymaster

    Hi,

    Thanks for the update and sorry for the confusion. The original code looked like a Linux application, where the C library is completely outside VisualGDB’s control. For embedded projects there are indeed several versions of the syscall implementations for different scenarios (e.g. with/without semihosting). VisualGDB should also be able to automatically download symbols and sources for those libraries and let you step into the syscalls, helping quickly understand which version is being used.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.