[BusyBox-cvs] busybox/util-linux rdate.c,1.29,1.30
Erik Andersen
andersen at busybox.net
Fri Dec 19 11:29:32 UTC 2003
Update of /var/cvs/busybox/util-linux
In directory nail:/tmp/cvs-serv21522/util-linux
Modified Files:
rdate.c
Log Message:
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.
Index: rdate.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/rdate.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- rdate.c 3 Nov 2003 21:20:14 -0000 1.29
+++ rdate.c 19 Dec 2003 11:29:29 -0000 1.30
@@ -103,8 +103,14 @@
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(¤t_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)
More information about the busybox-cvs
mailing list