Start a new topic

Clock time sync error

Dear Sir,


i am connecting my gateway through LAN port to Instamsg server. 

i have implemenented the UDP stack for NTP time sync but i am getting this error as below:


[CLOCK-ERROR] Failed in last step to sync time with system-clock.

[CLOCK-ERROR] Failed to sync-time through NTP.

Error.PNG
(5.18 KB)

 Hi Krunal.


Since this is a RTC which is synced from NTP-Server (which ALWAYS returns time in UTC), so the offset in this case is 0.


So, simply strcpy "0" to the buffer.

HI ,


I am using PCF2127AT RTC. in that there is no timezone sync or read or write option. 


How can i get it in getTimezoneOffset() function?

Hi Krunal.

All functions in device_time.c need to be implemented, mainly


 

/*
 * This method returns the current-tick/timestamp.
 */
unsigned long getCurrentTick()
{
    return 0;
}

 


 

/*
 * This method gets the time in the following-format
 *
 *          YYYYMMDD4HHMMSS
 *          201507304155546
 */
void getTimeInDesiredFormat(char *buffer, int maxBufferLength)
{
}

 


/*
 * This method gets the timezone-offset for this device.
 */
void getTimezoneOffset(char *buffer, int maxBufferLength)
{
}

 



 

Yes i am using RTC and it is having battery backup. 

please tell me which function will get time from RTC ?

Hi Krunal.

If there is no internet-connectivity, then obviously NTP-Server connectivity will fail, and this function will not be called via the NTP-workflow.

Please let me know what time-source are you using?
Is it a RTC? If yes, then I suppose RTC can keep time even when the device is powered off, so nothing extra needs to be done.

In summary (if your time-source is a RTC),

* The time will be picked up from RTC as usual.

* The RTC will be synced via NTP, whenever the internet is available. If no internet is there, then we will have to rely on the assumption that the RTC's time has not drifted.
I

 

HI,


How it will get time when LAN is not connected or internet is not working? 


Is there any function for that or no need to implement ??

Hi Krunal.


This error comes when the time-coordinates have been fetched fine from NTP-server, but the system clock has not been synced.


So, kindly implement the function

 

 

HTML
/*
 * Syncs the system-clock.
 *
 * Returns SUCCESS on successful-syncing.
 * Else returns FAILURE.
 */
int sync_system_clock(DateParams *dateParams, unsigned long seconds)
{
    return FAILURE;
}

 

 

in device_time.c


DateParams structure is defined in commom/instamsg/driver/include/time.h

Using the fields therein, the RTC/Modem-Time/Time-source clock can be synced.

 

Login or Signup to post a comment