Skip to content

Commit 65e897c

Browse files
committed
permit hh:mm:ss as well as hh:mm
1 parent 7759146 commit 65e897c

File tree

5 files changed

+28
-15
lines changed

5 files changed

+28
-15
lines changed

man/sadf.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ sadf \- Display data collected by sar in multiple formats.
55
.B sadf [ -C ] [ -c | -d | -j | -p | -x ] [ -H ] [ -h ] [ -T | -t | -U ] [ -V ] [ -P {
66
.I cpu
77
.B [,...] | ALL } ] [ -s [
8-
.I hh:mm:ss
8+
.I hh:mm[:ss]
99
.B ] ] [ -e [
10-
.I hh:mm:ss
10+
.I hh:mm[:ss]
1111
.B ] ] [ --
1212
.I sar_options
1313
.B ] [
@@ -116,7 +116,7 @@ by
116116
.I sar_options
117117
command line options.
118118
Note that timestamp output can be controlled by options -T, -t and -U.
119-
.IP "-e [ hh:mm:ss ]"
119+
.IP "-e [ hh:mm[:ss] ]"
120120
Set the ending time of the report, given in local time. The default ending
121121
time is 18:00:00. Hours must be given in 24-hour format.
122122
.IP -H
@@ -145,7 +145,7 @@ hostname of the host where the file was created, the interval value
145145
the device name (or - if not applicable),
146146
the field name and its value.
147147
Note that timestamp output can be controlled by options -T, -t and -U.
148-
.IP "-s [ hh:mm:ss ]"
148+
.IP "-s [ hh:mm[:ss] ]"
149149
Set the starting time of the data (given in local time), causing the
150150
.B sadf
151151
command to extract records time-tagged at, or following, the time

man/sar.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ sar \- Collect, report, or save system activity information.
2424
.B [ -i
2525
.I interval
2626
.B ] [ -s [
27-
.I hh:mm:ss
27+
.I hh:mm[:ss]
2828
.B ] ] [ -e [
29-
.I hh:mm:ss
29+
.I hh:mm[:ss]
3030
.B ] ] [
3131
.I interval
3232
.B [
@@ -343,7 +343,7 @@ devices serving requests in parallel, such as RAID arrays and modern SSDs,
343343
this number does not reflect their performance limits.
344344
.RE
345345
.RE
346-
.IP "-e [ hh:mm:ss ]"
346+
.IP "-e [ hh:mm[:ss] ]"
347347
Set the ending time of the report. The default ending time is
348348
18:00:00. Hours must be given in 24-hour format.
349349
This option can be used when data are read from
@@ -1962,7 +1962,7 @@ saves I/O).
19621962
Percentage of cached swap memory in relation to the amount of used swap space.
19631963
.RE
19641964
.RE
1965-
.IP "-s [ hh:mm:ss ]"
1965+
.IP "-s [ hh:mm[:ss] ]"
19661966
Set the starting time of the data, causing the
19671967
.B sar
19681968
command to extract records time-tagged at, or following, the time

sa_common.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ int datecmp(struct tm *rectime, struct tstamp *tse)
314314

315315
/*
316316
***************************************************************************
317-
* Parse a timestamp entered on the command line (hh:mm:ss) and decode it.
317+
* Parse a timestamp entered on the command line (hh:mm[:ss]) and decode it.
318318
*
319319
* IN:
320320
* @argv Arguments list.
@@ -333,10 +333,23 @@ int parse_timestamp(char *argv[], int *opt, struct tstamp *tse,
333333
{
334334
char timestamp[9];
335335

336-
if ((argv[++(*opt)]) && (strlen(argv[*opt]) == 8)) {
337-
strncpy(timestamp, argv[(*opt)++], 8);
338-
}
339-
else {
336+
if (argv[++(*opt)]) {
337+
switch (strlen(argv[*opt])) {
338+
339+
case 5:
340+
strncpy(timestamp, argv[(*opt)++], 5);
341+
strcat(timestamp,":00");
342+
break;
343+
344+
case 8:
345+
strncpy(timestamp, argv[(*opt)++], 8);
346+
break;
347+
348+
default:
349+
strncpy(timestamp, def_timestamp, 8);
350+
break;
351+
}
352+
} else {
340353
strncpy(timestamp, def_timestamp, 8);
341354
}
342355
timestamp[8] = '\0';

sadf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void usage(char *progname)
8888

8989
fprintf(stderr, _("Options are:\n"
9090
"[ -C ] [ -c | -d | -j | -p | -x ] [ -H ] [ -h ] [ -T | -t | -U ] [ -V ]\n"
91-
"[ -P { <cpu> [,...] | ALL } ] [ -s [ <hh:mm:ss> ] ] [ -e [ <hh:mm:ss> ] ]\n"
91+
"[ -P { <cpu> [,...] | ALL } ] [ -s [ <hh:mm[:ss]> ] ] [ -e [ <hh:mm[:ss]> ] ]\n"
9292
"[ -- <sar_options> ]\n"));
9393
exit(1);
9494
}

sar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void usage(char *progname)
114114
"[ -m { <keyword> [,...] | ALL } ] [ -n { <keyword> [,...] | ALL } ]\n"
115115
"[ -j { ID | LABEL | PATH | UUID | ... } ]\n"
116116
"[ -f [ <filename> ] | -o [ <filename> ] | -[0-9]+ ]\n"
117-
"[ -i <interval> ] [ -s [ <hh:mm:ss> ] ] [ -e [ <hh:mm:ss> ] ]\n"));
117+
"[ -i <interval> ] [ -s [ <hh:mm[:ss]> ] ] [ -e [ <hh:mm[:ss]> ] ]\n"));
118118
exit(1);
119119
}
120120

0 commit comments

Comments
 (0)