diff options
Diffstat (limited to 'networking/ntpd.c')
-rw-r--r-- | networking/ntpd.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/networking/ntpd.c b/networking/ntpd.c index 6707e9bdb..ca4afa045 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c | |||
@@ -1765,6 +1765,10 @@ recv_and_process_client_pkt(void /*int fd*/) | |||
1765 | /* this time was obtained between poll() and recv() */ | 1765 | /* this time was obtained between poll() and recv() */ |
1766 | msg.m_rectime = d_to_lfp(G.cur_time); | 1766 | msg.m_rectime = d_to_lfp(G.cur_time); |
1767 | msg.m_xmttime = d_to_lfp(gettime1900d()); /* this instant */ | 1767 | msg.m_xmttime = d_to_lfp(gettime1900d()); /* this instant */ |
1768 | if (G.peer_cnt == 0) { | ||
1769 | /* we have no peers: "stratum 1 server" mode. reftime = our own time */ | ||
1770 | G.reftime = G.cur_time; | ||
1771 | } | ||
1768 | msg.m_reftime = d_to_lfp(G.reftime); | 1772 | msg.m_reftime = d_to_lfp(G.reftime); |
1769 | msg.m_orgtime = query_xmttime; | 1773 | msg.m_orgtime = query_xmttime; |
1770 | msg.m_rootdelay = d_to_sfp(G.rootdelay); | 1774 | msg.m_rootdelay = d_to_sfp(G.rootdelay); |
@@ -1902,8 +1906,13 @@ static NOINLINE void ntp_init(char **argv) | |||
1902 | bb_show_usage(); | 1906 | bb_show_usage(); |
1903 | // if (opts & OPT_x) /* disable stepping, only slew is allowed */ | 1907 | // if (opts & OPT_x) /* disable stepping, only slew is allowed */ |
1904 | // G.time_was_stepped = 1; | 1908 | // G.time_was_stepped = 1; |
1905 | while (peers) | 1909 | if (peers) { |
1906 | add_peers(llist_pop(&peers)); | 1910 | while (peers) |
1911 | add_peers(llist_pop(&peers)); | ||
1912 | } else { | ||
1913 | /* -l but no peers: "stratum 1 server" mode */ | ||
1914 | G.stratum = 1; | ||
1915 | } | ||
1907 | if (!(opts & OPT_n)) { | 1916 | if (!(opts & OPT_n)) { |
1908 | bb_daemonize_or_rexec(DAEMON_DEVNULL_STDIO, argv); | 1917 | bb_daemonize_or_rexec(DAEMON_DEVNULL_STDIO, argv); |
1909 | logmode = LOGMODE_NONE; | 1918 | logmode = LOGMODE_NONE; |