[BusyBox] (patch) rdate - show time difference
hw-fr
wharms at bfs.de
Sun May 1 10:31:13 UTC 2005
Hi list,
for my embedded system i need to know how much the time was corrected. this
patch shows the time difference when -v is used.
Is there any rationale why you can not used set & print together ?
re,
walter
--- busybox-1.00/util-linux/rdate.c 2004-01-18 19:18:33.000000000 +0100
+++ busybox-1.00/util-linux/rdate.c.new 2005-04-28 19:57:22.000000000 +0200
@@ -81,9 +81,10 @@
int opt;
int setdate = 1;
int printdate = 1;
+ int verbose = 0;
/* Interpret command line args */
- while ((opt = getopt(argc, argv, "sp")) > 0) {
+ while ((opt = getopt(argc, argv, "spv")) > 0) {
switch (opt) {
case 's':
printdate = 0;
@@ -93,6 +94,9 @@
printdate = 1;
setdate = 0;
break;
+ case 'v':
+ verbose = 1;
+ break;
default:
bb_show_usage();
}
@@ -109,10 +113,12 @@
time(¤t_time);
if (current_time == remote_time)
bb_error_msg("Current time matches remote time.");
- else
+ else {
+ printf("Time delta %d\n",current_time-remote_time);
if (stime(&remote_time) < 0)
bb_perror_msg_and_die("Could not set time of
day");
- }
+ }
+ }
if (printdate)
printf("%s", ctime(&remote_time));
--- busybox-1.00/include/usage.h.bak 2005-05-01 11:10:20.000000000 +0200
+++ busybox-1.00/include/usage.h 2005-05-01 11:11:58.000000000 +0200
@@ -1978,11 +1978,12 @@
"/root\n"
#define rdate_trivial_usage \
- "[-sp] HOST"
+ "[-spv] HOST"
#define rdate_full_usage \
"Get and possibly set the system date and time from a remote HOST.\n
\n" \
"Options:\n" \
"\t-s\tSet the system date and time (default).\n" \
+ "\t-v\tShow the time difference.\n" \
"\t-p\tPrint the date and time."
#define readlink_trivial_usage \
More information about the busybox
mailing list