Hi,
Quote:
Originally Posted by cdr_nitjsr@yahoo.com
Dear friends i am having a System on module having arm processor and external rtc on it. The system is having embeded linux installed on it. I want to synchronise the RTC time from a NTP server on the network. How can i do this . Plese suggest possible soln with C code.
Thanking You all in advance.
|
You could use 'ntpd' and cron job to update the time via a script;
Code:
#!/bin/sh
#11-06-06 gws use ntp
/usr/sbin/ntpdate -v 0.us.pool.ntp.org ntp-1.mcs.anl.gov ntp-2.mcs.anl.gov &&hwclock --systohc
#--hctosys
#/usr/sbin/netdate time.mtco.com && /sbin/hwclock --systohc
No need to write 'c" to re-invent a function that is readily available. I place the above script in my '/etc/cron.hourly' as 'time' to update time. Be sure to make the 'time' script 'x' via chmod a+x /etc/cron.hourly/time
Hope this helps.
Have fun & enjoy!