]>
Commit | Line | Data |
---|---|---|
0bc1a539 MS |
1 | /* |
2 | * CUPS cupsGetDests API test program for CUPS. | |
3 | * | |
4 | * Copyright 2017 by Apple Inc. | |
5 | * | |
e3101897 | 6 | * Licensed under Apache License v2.0. See the file "LICENSE" for more information. |
0bc1a539 MS |
7 | */ |
8 | ||
9 | /* | |
10 | * Include necessary headers... | |
11 | */ | |
12 | ||
86390cbf MS |
13 | #include <stdio.h> |
14 | #include "cups.h" | |
15 | #include <sys/time.h> | |
16 | ||
17 | ||
0bc1a539 MS |
18 | /* |
19 | * 'main()' - Loop calling cupsGetDests. | |
20 | */ | |
21 | ||
22 | int /* O - Exit status */ | |
23 | main(void) | |
86390cbf | 24 | { |
0bc1a539 MS |
25 | int num_dests; /* Number of destinations */ |
26 | cups_dest_t *dests; /* Destinations */ | |
27 | struct timeval start, end; /* Start and stop time */ | |
28 | double secs; /* Total seconds to run cupsGetDests */ | |
86390cbf | 29 | |
0bc1a539 MS |
30 | |
31 | for (;;) | |
86390cbf MS |
32 | { |
33 | gettimeofday(&start, NULL); | |
34 | num_dests = cupsGetDests(&dests); | |
35 | gettimeofday(&end, NULL); | |
36 | secs = end.tv_sec - start.tv_sec + 0.000001 * (end.tv_usec - start.tv_usec); | |
0bc1a539 | 37 | |
86390cbf | 38 | printf("Found %d printers in %.3f seconds...\n", num_dests, secs); |
0bc1a539 MS |
39 | |
40 | cupsFreeDests(num_dests, dests); | |
41 | sleep(1); | |
86390cbf | 42 | } |
86390cbf MS |
43 | |
44 | return (0); | |
45 | } |