rdate
UDP 37번포트 사용
ntpdate
123번포트 사용
-b
Force the time to be stepped using the settimeofday() system call, rather than slewed (default) using the adjtime() system call. This option should be used when called from a startup file at boot time.
-u
Direct ntpdate to use an unprivileged port for outgoing packets. This is most useful when behind a firewall that blocks incoming traffic to privileged ports, and you want to synchronize with hosts beyond the firewall. Note that the -d option always uses unprivileged ports.
※ ntpdate는 settimeofday(), adjtime()의 2가지 시스템 콜로 시간을 설정한다.
settimeofday()은 timezone과 시간을 설정하고, adjtime()은 점근적 시각 보정 방식으로 커널 클럭을 조정한다. 주로 시간 동기화에 사용한다.
ntpdate는 옵션(-b, -B)을 지정하지 않으면 현재 시스템 시간과 차이가 128ms 이상이면 settimeofday()을, 이내이면 adjtime()을 사용한다.
또한 강제적으로 ntpdate -b 로 settimeofday()를, ntpdate -B로 adjtime()를 사용할 수 있다.
ntpdate 실행 결과 메시지에 'step time server...'로 표시되면 setimeofday()가 사용되었고, 'adjust time server...' 로 표시되면 adjtime()가 사용되었다.
부팅할 때는 ntpdate -b 로, cron등으로 정기적으로 시간조절을 할 때는 옵션없이 ntpdate 사용
즉.... 패킷 시간차까지 계산해 주는 ntpdate가 rdate 보다 정확도가 높다.