]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/testgetdests.c
459998f92020d2cd2d94911fc1dce57a4dcfac33
[thirdparty/cups.git] / cups / testgetdests.c
1 /*
2 * CUPS cupsGetDests API test program for CUPS.
3 *
4 * Copyright 2017 by Apple Inc.
5 *
6 * These coded instructions, statements, and computer programs are the
7 * property of Apple Inc. and are protected by Federal copyright
8 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
9 * which should have been included with this file. If this file is
10 * missing or damaged, see the license at "http://www.cups.org/".
11 *
12 * This file is subject to the Apple OS-Developed Software exception.
13 */
14
15 /*
16 * Include necessary headers...
17 */
18
19 #include <stdio.h>
20 #include "cups.h"
21 #include <sys/time.h>
22
23
24 /*
25 * 'main()' - Loop calling cupsGetDests.
26 */
27
28 int /* O - Exit status */
29 main(void)
30 {
31 int num_dests; /* Number of destinations */
32 cups_dest_t *dests; /* Destinations */
33 struct timeval start, end; /* Start and stop time */
34 double secs; /* Total seconds to run cupsGetDests */
35
36
37 for (;;)
38 {
39 gettimeofday(&start, NULL);
40 num_dests = cupsGetDests(&dests);
41 gettimeofday(&end, NULL);
42 secs = end.tv_sec - start.tv_sec + 0.000001 * (end.tv_usec - start.tv_usec);
43
44 printf("Found %d printers in %.3f seconds...\n", num_dests, secs);
45
46 cupsFreeDests(num_dests, dests);
47 sleep(1);
48 }
49
50 return (0);
51 }