1 /* 2 +----------------------------------------------------------------------+ 3 | Copyright (c) The PHP Group | 4 +----------------------------------------------------------------------+ 5 | This source file is subject to version 3.01 of the PHP license, | 6 | that is bundled with this package in the file LICENSE, and is | 7 | available through the world-wide-web at the following url: | 8 | https://www.php.net/license/3_01.txt | 9 | If you did not receive a copy of the PHP license and are unable to | 10 | obtain it through the world-wide-web, please send a note to | 11 | license@php.net so we can mail you a copy immediately. | 12 +----------------------------------------------------------------------+ 13 | Author: Niklas Keller <kelunik@php.net> | 14 | Author: Anatol Belski <ab@php.net> | 15 +----------------------------------------------------------------------+ 16 */ 17 18 #ifndef HRTIME_H 19 #define HRTIME_H 20 21 #define PHP_HRTIME_PLATFORM_POSIX 0 22 #define PHP_HRTIME_PLATFORM_WINDOWS 0 23 #define PHP_HRTIME_PLATFORM_APPLE 0 24 #define PHP_HRTIME_PLATFORM_HPUX 0 25 #define PHP_HRTIME_PLATFORM_AIX 0 26 27 #if defined(_POSIX_TIMERS) && ((_POSIX_TIMERS > 0) || defined(__OpenBSD__)) && defined(_POSIX_MONOTONIC_CLOCK) && defined(CLOCK_MONOTONIC) 28 # undef PHP_HRTIME_PLATFORM_POSIX 29 # define PHP_HRTIME_PLATFORM_POSIX 1 30 #elif defined(_WIN32) || defined(_WIN64) 31 # undef PHP_HRTIME_PLATFORM_WINDOWS 32 # define PHP_HRTIME_PLATFORM_WINDOWS 1 33 #elif defined(__APPLE__) 34 # undef PHP_HRTIME_PLATFORM_APPLE 35 # define PHP_HRTIME_PLATFORM_APPLE 1 36 #elif (defined(__hpux) || defined(hpux)) || ((defined(__sun__) || defined(__sun) || defined(sun)) && (defined(__SVR4) || defined(__svr4__))) 37 # undef PHP_HRTIME_PLATFORM_HPUX 38 # define PHP_HRTIME_PLATFORM_HPUX 1 39 #elif defined(_AIX) 40 # undef PHP_HRTIME_PLATFORM_AIX 41 # define PHP_HRTIME_PLATFORM_AIX 1 42 #endif 43 44 #define HRTIME_AVAILABLE (PHP_HRTIME_PLATFORM_POSIX || PHP_HRTIME_PLATFORM_WINDOWS || PHP_HRTIME_PLATFORM_APPLE || PHP_HRTIME_PLATFORM_HPUX || PHP_HRTIME_PLATFORM_AIX) 45 46 BEGIN_EXTERN_C() 47 48 typedef uint64_t php_hrtime_t; 49 50 PHPAPI php_hrtime_t php_hrtime_current(void); 51 52 PHP_MINIT_FUNCTION(hrtime); 53 54 END_EXTERN_C() 55 56 #endif /* HRTIME_H */ 57