]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.2/Modules/timing.h
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Modules / timing.h
CommitLineData
4710c53d 1/*\r
2 * Copyright (c) 1993 George V. Neville-Neil\r
3 * All rights reserved.\r
4 *\r
5 * Redistribution and use in source and binary forms, with or without\r
6 * modification, are permitted provided that the following conditions\r
7 * are met:\r
8 * 1. Redistributions of source code must retain the above copyright\r
9 * notice, this list of conditions and the following disclaimer.\r
10 * 2. Redistributions in binary form must reproduce the above copyright\r
11 * notice, this list of conditions and the following disclaimer in the\r
12 * documentation and/or other materials provided with the distribution.\r
13 * 3. The name, George Neville-Neil may not be used to endorse or promote\r
14 * products derived from this software without specific prior\r
15 * written permission.\r
16 *\r
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\r
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE\r
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
27 * SUCH DAMAGE.\r
28 */\r
29\r
30#ifndef _TIMING_H_\r
31#define _TIMING_H_\r
32\r
33#ifdef TIME_WITH_SYS_TIME\r
34#include <sys/time.h>\r
35#include <time.h>\r
36#else /* !TIME_WITH_SYS_TIME */\r
37#ifdef HAVE_SYS_TIME_H\r
38#include <sys/time.h>\r
39#else /* !HAVE_SYS_TIME_H */\r
40#include <time.h>\r
41#endif /* !HAVE_SYS_TIME_H */\r
42#endif /* !TIME_WITH_SYS_TIME */\r
43\r
44static struct timeval aftertp, beforetp;\r
45\r
46#define BEGINTIMING gettimeofday(&beforetp, NULL)\r
47\r
48#define ENDTIMING gettimeofday(&aftertp, NULL); \\r
49 if(beforetp.tv_usec > aftertp.tv_usec) \\r
50 { \\r
51 aftertp.tv_usec += 1000000; \\r
52 aftertp.tv_sec--; \\r
53 }\r
54\r
55#define TIMINGUS (((aftertp.tv_sec - beforetp.tv_sec) * 1000000) + \\r
56 (aftertp.tv_usec - beforetp.tv_usec))\r
57\r
58#define TIMINGMS (((aftertp.tv_sec - beforetp.tv_sec) * 1000) + \\r
59 ((aftertp.tv_usec - beforetp.tv_usec) / 1000))\r
60\r
61#define TIMINGS ((aftertp.tv_sec - beforetp.tv_sec) + \\r
62 (aftertp.tv_usec - beforetp.tv_usec) / 1000000)\r
63\r
64#endif /* _TIMING_H_ */\r