]> granicus.if.org Git - cronie/commitdiff
round time on the minute
authorsgerwk <sgerwk@aol.com>
Sat, 28 Oct 2017 10:58:47 +0000 (12:58 +0200)
committerTomas Mraz <tmraz@fedoraproject.org>
Fri, 3 Nov 2017 13:47:25 +0000 (14:47 +0100)
man/cronnext.1
src/cronnext.c

index 4233c42c2c0bed303d782227c135792591c80681..89e4abed72af66280b77d0a27a5f588be6aeecc5 100644 (file)
@@ -12,7 +12,8 @@ cronnext \- time of next job cron will execute
 .SH DESCRIPTION
 Determine the time cron will execute the next job.  Without arguments, it
 prints that time considering all crontabs, in number of seconds since the
-Epoch.  This number can be converted into other formats using
+Epoch, rounded to the minute. This number can be converted into other formats
+using
 .BR date (1),
 like
 .B date --date @43243254
@@ -44,11 +45,12 @@ file arguments. This is implicit if no file is passed.
 .BI "\-t " time
 Determine the next job from this time, instead of now.  The time is
 expressed in number of seconds since the Epoch, as obtained for example by
-.BR "date +%s --date \(dqnow + 2 hours\(dq" .
+.BR "date +%s --date \(dqnow + 2 hours\(dq" ,
+and is internally rounded to the minute.
 .TP
 .BI "\-q " time
-Do not check jobs over this time, expressed in number of seconds since the
-Epoch.
+Do not check jobs over this time, expressed in the same way as in option
+.BR -t .
 .TP
 .B \-l
 Print the whole entries of the jobs that are the next to be executed by cron.
index eebe410430c2701889b7d0b53d4538cbabed2eb7..306a16eaab3160ab7594a6cd17d6a0cfe304fe2b 100644 (file)
@@ -329,7 +329,7 @@ int main(int argn, char *argv[]) {
        flags = SYSTEM;
        endtime = 0;
        printjobs = 0;
-       start = time(NULL);
+       start = time(NULL) / 60 * 60;
 
        while (-1 != (opt = getopt(argn, argv, "i:e:ast:q:lcfhV"))) {
                switch (opt) {
@@ -346,10 +346,10 @@ int main(int argn, char *argv[]) {
                        flags &= ~SYSTEM;
                        break;
                case 't':
-                       start = atoi(optarg);
+                       start = atoi(optarg) / 60 * 60;
                        break;
                case 'q':
-                       end = atoi(optarg);
+                       end = atoi(optarg) / 60 * 60;
                        endtime = 1;
                        break;
                case 'l':