diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-25 19:30:16 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-25 19:30:16 +0100 |
commit | 24928ffd8d6eb7f410ea0a7b4530086cecfeea6e (patch) | |
tree | fa0c4b0cdcebb2c4a9f8d5aefcd42fcafcbb89da /networking/ntpd.c | |
parent | 3581c625151d25d8e1cbc80c44337d398d97cf42 (diff) | |
download | busybox-w32-24928ffd8d6eb7f410ea0a7b4530086cecfeea6e.tar.gz busybox-w32-24928ffd8d6eb7f410ea0a7b4530086cecfeea6e.tar.bz2 busybox-w32-24928ffd8d6eb7f410ea0a7b4530086cecfeea6e.zip |
ntpd: explain why scripts can be run in quick succession
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/ntpd.c')
-rw-r--r-- | networking/ntpd.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/networking/ntpd.c b/networking/ntpd.c index 95dfdb119..04df3fa7f 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c | |||
@@ -735,6 +735,13 @@ send_query_to_peer(peer_t *p) | |||
735 | } | 735 | } |
736 | 736 | ||
737 | 737 | ||
738 | /* Note that there is no provision to prevent several run_scripts | ||
739 | * to be done in quick succession. In fact, it happens rather often | ||
740 | * if initial syncronization results in a step. | ||
741 | * You will see "step" and then "stratum" script runs, sometimes | ||
742 | * as close as only 0.002 seconds apart. | ||
743 | * Script should be ready to deal with this. | ||
744 | */ | ||
738 | static void run_script(const char *action, double offset) | 745 | static void run_script(const char *action, double offset) |
739 | { | 746 | { |
740 | char *argv[3]; | 747 | char *argv[3]; |
@@ -1185,8 +1192,8 @@ update_local_clock(peer_t *p) | |||
1185 | abs_offset = fabs(offset); | 1192 | abs_offset = fabs(offset); |
1186 | 1193 | ||
1187 | #if 0 | 1194 | #if 0 |
1188 | /* If needed, -S script can detect this by looking at $offset | 1195 | /* If needed, -S script can do it by looking at $offset |
1189 | * env var and kill parent */ | 1196 | * env var and killing parent */ |
1190 | /* If the offset is too large, give up and go home */ | 1197 | /* If the offset is too large, give up and go home */ |
1191 | if (abs_offset > PANIC_THRESHOLD) { | 1198 | if (abs_offset > PANIC_THRESHOLD) { |
1192 | bb_error_msg_and_die("offset %f far too big, exiting", offset); | 1199 | bb_error_msg_and_die("offset %f far too big, exiting", offset); |
@@ -2007,7 +2014,7 @@ int ntpd_main(int argc UNUSED_PARAM, char **argv) | |||
2007 | nfds = poll(pfd, i, timeout * 1000); | 2014 | nfds = poll(pfd, i, timeout * 1000); |
2008 | gettime1900d(); /* sets G.cur_time */ | 2015 | gettime1900d(); /* sets G.cur_time */ |
2009 | if (nfds <= 0) { | 2016 | if (nfds <= 0) { |
2010 | if (G.cur_time - G.last_script_run > 11*60) { | 2017 | if (G.script_name && G.cur_time - G.last_script_run > 11*60) { |
2011 | /* Useful for updating battery-backed RTC and such */ | 2018 | /* Useful for updating battery-backed RTC and such */ |
2012 | run_script("periodic", G.last_update_offset); | 2019 | run_script("periodic", G.last_update_offset); |
2013 | gettime1900d(); /* sets G.cur_time */ | 2020 | gettime1900d(); /* sets G.cur_time */ |