diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-12-19 11:29:29 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-12-19 11:29:29 +0000 |
commit | 877f4ea4398d340d8655e6583f95535a52f4c8b7 (patch) | |
tree | f68ba5f7a4c1460039dc9a566de22276c86ece42 | |
parent | f688fdb233175cb9f03dc2a6ab24605c1982b728 (diff) | |
download | busybox-w32-877f4ea4398d340d8655e6583f95535a52f4c8b7.tar.gz busybox-w32-877f4ea4398d340d8655e6583f95535a52f4c8b7.tar.bz2 busybox-w32-877f4ea4398d340d8655e6583f95535a52f4c8b7.zip |
Patch from Fillod Stephane:
* The "rdate.patch" file makes rdate to NOT settimeofday if the date to be
set equals current date. This prevents the system from experiencing nasty time
discontinuities caused by sub-second changes, with a protocol that has only
over second resolution. Depending on your taste, the "fprintf(stderr..." may be
removed.
git-svn-id: svn://busybox.net/trunk/busybox@8127 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | util-linux/rdate.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/util-linux/rdate.c b/util-linux/rdate.c index c9a7ffeab..0b5f8e460 100644 --- a/util-linux/rdate.c +++ b/util-linux/rdate.c | |||
@@ -103,8 +103,14 @@ int rdate_main(int argc, char **argv) | |||
103 | remote_time = askremotedate(argv[optind]); | 103 | remote_time = askremotedate(argv[optind]); |
104 | 104 | ||
105 | if (setdate) { | 105 | if (setdate) { |
106 | if (stime(&remote_time) < 0) | 106 | time_t current_time; |
107 | bb_perror_msg_and_die("Could not set time of day"); | 107 | |
108 | time(¤t_time); | ||
109 | if (current_time == remote_time) | ||
110 | bb_error_msg("Current time matches remote time."); | ||
111 | else | ||
112 | if (stime(&remote_time) < 0) | ||
113 | bb_perror_msg_and_die("Could not set time of day"); | ||
108 | } | 114 | } |
109 | 115 | ||
110 | if (printdate) | 116 | if (printdate) |