summaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorEric Andersen2003-12-19 11:29:29 +0000
committerEric Andersen2003-12-19 11:29:29 +0000
commit89f10bcf3790dabbeae4276fa1e1a6d9e9325d9c (patch)
treef68ba5f7a4c1460039dc9a566de22276c86ece42 /util-linux
parent769a3ef08dba4097047ae12ac5c8e05927a20a75 (diff)
downloadbusybox-89f10bcf3790dabbeae4276fa1e1a6d9e9325d9c.zip
busybox-89f10bcf3790dabbeae4276fa1e1a6d9e9325d9c.tar.gz
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.
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/rdate.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
index c9a7ffe..0b5f8e4 100644
--- a/util-linux/rdate.c
+++ b/util-linux/rdate.c
@@ -103,8 +103,14 @@ int rdate_main(int argc, char **argv)
remote_time = askremotedate(argv[optind]);
if (setdate) {
- if (stime(&remote_time) < 0)
- bb_perror_msg_and_die("Could not set time of day");
+ time_t current_time;
+
+ time(&current_time);
+ if (current_time == remote_time)
+ bb_error_msg("Current time matches remote time.");
+ else
+ if (stime(&remote_time) < 0)
+ bb_perror_msg_and_die("Could not set time of day");
}
if (printdate)