This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2642R-Q1: CC2642 time_t mktime(struct tm *_tptr);

Part Number: CC2642R-Q1

HI,

    when i use time.h->mktime().the result is negative number.but the time stamp should be a positive number.

    

    struct tm temp;
    struct tm *tm = &temp;
    
    tm->tm_year  = 2022;
    tm->tm_mon  = 4;
    tm->tm_mday = 1;
    tm->tm_hour = 1;
    tm->tm_min = 36;
    tm->tm_sec = 16;
    tm->tm_wday = 5;
    tm->tm_yday = 90;
    tm->tm_isdst = -1;

    long tm_unix = mktime(tm);
    
    printf("tm_unix: %d", tm_unix);

result:        tm_unix: -606036464