1 --- io.c 2004-01-16 11:31:47.000000000 -0500
2 +++ io.c 2004-04-19 16:07:57.000000000 -0400
12 select(0, NULL, NULL, NULL, &tv);
16 + * When --timelimit is used, compare rsync_start_time and the current time
17 + * and return 1 when the timelimit has been reached.
19 +static int has_timelimit_expired()
22 + time_t start_time = 0;
23 + time_t expiration_time = 0;
25 + assert(timelimit > 0);
27 + start_time = get_rsync_start_time();
28 + assert(start_time > 0);
30 + gettimeofday(&tv, NULL);
31 + expiration_time = start_time + (timelimit * 60);
33 + return tv.tv_sec > expiration_time;
37 * Write len bytes to the file descriptor @p fd.
41 sleep_for_bwlimit(ret);
43 + if (timelimit && has_timelimit_expired()) {
44 + rprintf(FERROR, RSYNC_NAME ": \n%d minute time limit exceeded.\n", timelimit);
45 + exit_cleanup(RERR_PARTIAL);
50 --- options.c 2004-04-17 13:07:23.000000000 -0400
51 +++ options.c 2004-04-19 16:07:57.000000000 -0400
53 int copy_unsafe_links = 0;
58 int only_existing = 0;
59 int opt_ignore_existing = 0;
61 rprintf(F," --log-format=FORMAT log file transfers using specified format\n");
62 rprintf(F," --password-file=FILE get password from FILE\n");
63 rprintf(F," --bwlimit=KBPS limit I/O bandwidth, KBytes per second\n");
64 + rprintf(F," --timelimit=MINS Stop rsync after MINS minutes\n");
65 rprintf(F," --write-batch=PREFIX write batch fileset starting with PREFIX\n");
66 rprintf(F," --read-batch=PREFIX read batch fileset starting with PREFIX\n");
67 rprintf(F," -h, --help show this help screen\n");
69 {"port", 0, POPT_ARG_INT, &rsync_port, 0, 0, 0 },
70 {"log-format", 0, POPT_ARG_STRING, &log_format, 0, 0, 0 },
71 {"bwlimit", 0, POPT_ARG_INT, &bwlimit, 0, 0, 0 },
72 + {"timelimit", 0, POPT_ARG_INT, &timelimit, 0, 0, 0 },
73 {"address", 0, POPT_ARG_STRING, &bind_address, 0, 0, 0 },
74 {"backup-dir", 0, POPT_ARG_STRING, &backup_dir, 0, 0, 0 },
75 {"hard-links", 'H', POPT_ARG_NONE, &preserve_hard_links, 0, 0, 0 },
79 if (asprintf(&arg, "--bwlimit=%d", bwlimit) < 0)
85 + if (asprintf(&arg, "--timelimit=%d", timelimit) < 0)
89 --- proto.h 2004-04-14 19:33:30.000000000 -0400
90 +++ proto.h 2004-04-19 16:07:57.000000000 -0400
92 int unsafe_symlink(const char *dest, const char *src);
93 char *timestring(time_t t);
95 +time_t get_rsync_start_time(void);
96 int cmp_modtime(time_t file1, time_t file2);
97 int _Insure_trap_error(int a1, int a2, int a3, int a4, int a5, int a6);
98 void *_new_array(unsigned int size, unsigned long num);
99 --- rsync.yo 17 Apr 2004 18:40:16 -0000 1.159
100 +++ rsync.yo 19 Apr 2004 20:50:45 -0000
102 --log-format=FORMAT log file transfers using specified format
103 --password-file=FILE get password from FILE
104 --bwlimit=KBPS limit I/O bandwidth, KBytes per second
105 + --timelimit=MINS Stop rsync after MINS minutes
106 --write-batch=PREFIX write batch fileset starting with PREFIX
107 --read-batch=PREFIX read batch fileset starting with PREFIX
108 -h, --help show this help screen
110 transfer was too fast, it will wait before sending the next data block. The
111 result is an average transfer rate equaling the specified limit. A value
112 of zero specifies no limit.
114 +dit(bf(--timelimit=MINS)) This option allows you to specify the maximum
115 +number of minutes rsync will run for. Ths time starts when the first
116 +file starts transferring.
118 dit(bf(--write-batch=PREFIX)) Generate a set of files that can be
119 transferred as a batch update. Each filename in the set starts with
120 --- util.c 2004-04-17 13:06:03.000000000 -0400
121 +++ util.c 2004-04-19 16:07:57.000000000 -0400
122 @@ -1050,6 +1050,21 @@
127 + * Return the time that rsync is started, used by --time-limit
129 +time_t get_rsync_start_time(void)
131 + static struct timeval tval;
132 + static int has_set_rsync_start_time = 0;
134 + if (!has_set_rsync_start_time) {
135 + gettimeofday(&tval, NULL);
136 + has_set_rsync_start_time = 1;
139 + return tval.tv_sec;
143 * Determine if two file modification times are equivalent (either