Imported Upstream version 20081130
[ltp-debian.git] / testcases / audit-test / utils / bin / do_stime.c
blob434b92c2386fed3df62191b4c615d2c64cca7408
1 /* (c) Copyright Hewlett-Packard Development Company, L.P., 2007
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of version 2 the GNU General Public License as
5 * published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #include "includes.h"
17 #include <time.h>
19 int main(int argc, char **argv)
21 int exitval, result;
22 struct timeval tv;
24 if (argc != 2) {
25 fprintf(stderr, "Usage:\n%s <seconds>\n", argv[0]);
26 return TEST_ERROR;
29 memset(&tv, 0, sizeof(tv));
30 tv.tv_sec = atol(argv[1]);
32 errno = 0;
33 exitval = stime(&tv.tv_sec);
34 result = exitval < 0;
36 printf("%d %d %d\n", result, result ? errno : exitval, getpid());
37 return result;