mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	bpo-30183: Fixes HP-UX cc compilation error in pytime.c (#1351)
* bpo-30183: Fixes HP-UX cc compilation error in pytime.c
HP-UX does not support the CLOCK_MONOTONIC identifier, and will fail to
compile:
    "Python/pytime.c", line 723: error #2020: identifier
    "CLOCK_MONOTONIC" is undefined
          const clockid_t clk_id = CLOCK_MONOTONIC;
Add a new section for __hpux that calls 'gethrtime()' instead of
'clock_gettime()'.
* bpo-30183: Removes unnecessary return
			
			
This commit is contained in:
		
							parent
							
								
									dcc8ce44c7
								
							
						
					
					
						commit
						c90e960150
					
				
					 1 changed files with 20 additions and 0 deletions
				
			
		|  | @ -693,6 +693,26 @@ pymonotonic(_PyTime_t *tp, _Py_clock_info_t *info, int raise) | ||||||
|         info->adjustable = 0; |         info->adjustable = 0; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | #elif defined(__hpux) | ||||||
|  |     hrtime_t time; | ||||||
|  | 
 | ||||||
|  |     time = gethrtime(); | ||||||
|  |     if (time == -1) { | ||||||
|  |         if (raise) { | ||||||
|  |             PyErr_SetFromErrno(PyExc_OSError); | ||||||
|  |         } | ||||||
|  |         return -1; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     *tp = time; | ||||||
|  | 
 | ||||||
|  |     if (info) { | ||||||
|  |         info->implementation = "gethrtime()"; | ||||||
|  |         info->resolution = 1e-9; | ||||||
|  |         info->monotonic = 1; | ||||||
|  |         info->adjustable = 0; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| #else | #else | ||||||
|     struct timespec ts; |     struct timespec ts; | ||||||
| #ifdef CLOCK_HIGHRES | #ifdef CLOCK_HIGHRES | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue