Quantcast
Viewing all articles
Browse latest Browse all 262198

RTOS/MSP432P401R: about clock_settime function

Part Number:MSP432P401R

Tool/software:TI-RTOS

HI sir,

When I was using clock_settime   function, I found that when the set time is 2018/1/1 0:0:0,

Cannot write correctly.

struct tm tm;
    tm.tm_year =48;
    tm.tm_mon = 0;    
    tm.tm_mday=1;   
    tm.tm_hour=0;   
    tm.tm_min=0;    
    tm.tm_sec=0;

    time_t t = mktime(&tm);
    const struct timespec ts1 = {        .tv_sec = t,        .tv_nsec = 0    };// Set this to the current UNIX time in seconds
    clock_settime(CLOCK_REALTIME, &ts1);
clock_gettime(CLOCK_REALTIME, &utc_0);
utc_str = utc_0.tv_sec+2208988800L; //-- CCS start 1900 ..
    Display_printf(display, 0, 0, "Time %s ",ctime(&utc_str) );

output is Time Sun Dec 31 00:00:00 2017

Can someone help confirm?

thank


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>