Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

CC3200: wrong date-time calculation from SNTP

$
0
0

Part Number:CC3200

Hello all,

I am using cc3200 controller. In my application I am using SNTP time to feed my RTC. Now, I am facing problem with the SNTP time coming from the ntp server, it is showing wrong date.

I checked the GetSNTPTime() function in time.c and tried to calculate using debugger where is the problem.

I am using IST time zone so time difference will be +5:30 of GMT and I am taking time from this server 0.asia.pool.ntp.org. So taking the example of todays date-time it must show 31-12-2018 16:17:20. But now it is showing 00-01-2019 16:17:20. I checked the URL but it is giving correct time so there might be problem with the calculations in the function GetSNTPTime()

Earlier also in the same function on every 31st day of the month it starts giving 00, I made it correct in the calculation of month

        for (iIndex = 0; iIndex < 12; iIndex++)
        {
            g_sAppData.isGeneralVar -= g_acNumOfDaysPerMonth[iIndex];
            if (g_sAppData.isGeneralVar <= 0)
                    break;
        }

I made changes in the if condition earlier it was

g_sAppData.isGeneralVar = 0

I change it to 

g_sAppData.isGeneralVar <= 0

This correction resolved my problem with day, now I am facing problem with the year due to which month and day also get wrong.


Viewing all articles
Browse latest Browse all 262198

Trending Articles



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