Avoid copying timeval onto stack

This commit is contained in:
Philip Prindeville 2023-08-14 17:52:59 +00:00 committed by Olof Hagsand
parent 4a605ff25e
commit dc0f740a04
5 changed files with 11 additions and 13 deletions

View file

@ -241,10 +241,9 @@ main(int argc, char **argv)
break;
case 's': /* start-time */
if (*optarg == '+' || *optarg == '-'){
struct timeval t;
t = now;
struct timeval t = now;
t.tv_sec += atoi(optarg);
if (time2str(t, start, sizeof(start)) < 0)
if (time2str(&t, start, sizeof(start)) < 0)
goto done;
}
else
@ -252,10 +251,9 @@ main(int argc, char **argv)
break;
case 'e': /* stop-time */
if (*optarg == '+' || *optarg == '-'){
struct timeval t;
t = now;
struct timeval t = now;
t.tv_sec += atoi(optarg);
if (time2str(t, stop, sizeof(stop)) < 0)
if (time2str(&t, stop, sizeof(stop)) < 0)
goto done;
}
else