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.

LAUNCHCC3235MOD: Getting timestamp from NTP server

Part Number: LAUNCHCC3235MOD

Tool/software:

Hi,

My customer wants to get timestamp from NTP server using SNTP_getTime() API.
He refers to below document.
https://software-dl.ti.com/simplelink/esd/simplelink_msp432e4_sdk/4.20.00.12/docs/ns/html/group__ti__net__sntp__SNTP.html#gaf28840559d2f511e3fc376102bbc8837

He wanted to change NTP server to "ntp.nict.jp", then the code is like below.

int32_t  retVal;
uint32_t seconds;
uint32_t secondsFraction;
SlNetSock_Timeval_t timeval;
timeval.tv_sec  = 5;
timeval.tv_usec = 0;

uint64_t ntpTimeStamp = 0;

const char* srvList[] = {"ntp.nict.jp"};
int numServers = 1;

ret = SNTP_getTime(srvList, numServers, &timeval, &ntpTimeStamp);

But it seems timestamp taken is not from "ntp.nict.jp" server and default server list is used.
Where he needs to modify to take timestamp from "ntp.nict.jp"?

Thanks and regards,
Koichiro Tashiro

  • your code seems correct. can you step into the SNTP_getTime and check internally (the server list is selected at the beginning of the function based on the user input).

    what made you think that the default server list is used?

  • Hi Kobi,

    Thanks for your reply.

    what made you think that the default server list is used?

    The customer got UTC timestamp. He thought the timestamp should be JST if the server is "ntp.nict.jp".
    But it seems timestamp is always UTC regardless NTC server.

    He tested with wrong NTC server name and got below error code in SNTP task.
    So he understood his code properly configure NTC server.

    Error! code = -100, Description = sntptTask: get failed

    Now this item is closed.

    Thanks and regards,
    Koichiro Tashiro