6666#include <stdlib.h>
6767#include <string.h>
6868
69- #if defined(_WIN32 ) && !defined( __SYMBIAN32__ )
69+ #if defined(_WIN32 )
7070# include <windows.h>
71- # ifndef _WIN32_WCE
72- # include <time.h>
73- # endif
7471#elif defined(HAVE_UNISTD_H ) /* I know this, this is Unix... */
7572# include <unistd.h>
7673# include <sys/time.h>
8582#include <soundswallower/err.h>
8683#include <soundswallower/ckd_alloc.h>
8784
88- #if defined(_WIN32_WCE ) || defined(_WIN32_WP )
89- DWORD unlink (const char * filename )
90- {
91- WCHAR * wfilename ;
92- DWORD rv ;
93- size_t len ;
94-
95- len = mbstowcs (NULL , filename , 0 );
96- wfilename = ckd_calloc (len + 1 , sizeof (* wfilename ));
97- mbstowcs (wfilename , filename , len );
98- rv = DeleteFileW (wfilename );
99- ckd_free (wfilename );
100-
101- return rv ;
102- }
103- #endif
104-
10585pctr_t *
10686pctr_new (char * nm )
10787{
@@ -139,7 +119,7 @@ pctr_free(pctr_t * pc)
139119}
140120
141121
142- #if defined(_WIN32 ) && !defined( GNUWINCE ) && !defined( __SYMBIAN32__ )
122+ #if defined(_WIN32 )
143123
144124#define TM_LOWSCALE 1e-7
145125#define TM_HIGHSCALE (4294967296.0 * TM_LOWSCALE);
@@ -169,17 +149,10 @@ make_sec(struct timeval *s)
169149void
170150ptmr_start (ptmr_t * tm )
171151{
172- #if ( !defined(_WIN32 )) || defined( GNUWINCE ) || defined( __SYMBIAN32__ )
152+ #if !defined(_WIN32 )
173153 struct timeval e_start ; /* Elapsed time */
174154 gettimeofday (& e_start , 0 );
175155 tm -> start_elapsed = make_sec (& e_start );
176- #elif defined(_WIN32_WP )
177- tm -> start_cpu = GetTickCount64 () / 1000 ;
178- tm -> start_elapsed = GetTickCount64 () / 1000 ;
179- #elif defined(_WIN32_WCE )
180- /* No GetProcessTimes() on WinCE. (Note CPU time will be bogus) */
181- tm -> start_cpu = GetTickCount () / 1000 ;
182- tm -> start_elapsed = GetTickCount () / 1000 ;
183156#else
184157 HANDLE pid ;
185158 FILETIME t_create , t_exit , kst , ust ;
@@ -199,31 +172,22 @@ ptmr_stop(ptmr_t * tm)
199172{
200173 float64 dt_cpu , dt_elapsed ;
201174
202- #if (! defined(_WIN32 )) || defined(GNUWINCE ) || defined(__SYMBIAN32__ )
175+ #if !defined(_WIN32 )
176+ /* Unix */
203177 struct timeval e_stop ; /* Elapsed time */
204-
205- #if (! defined(_HPUX_SOURCE )) && (! defined(__SYMBIAN32__ ))
178+ # if defined(HAVE_GETRUSAGE ) && !defined(__EMSCRIPTEN__ ) /* Which LIES */
206179 struct rusage stop ; /* CPU time */
207-
208- /* Unix but not HPUX */
209180 getrusage (RUSAGE_SELF , & stop );
210181 dt_cpu =
211182 make_sec (& stop .ru_utime ) + make_sec (& stop .ru_stime ) -
212183 tm -> start_cpu ;
213- #else
184+ # else
214185 dt_cpu = 0.0 ;
215- #endif
216- /* Unix + HP */
186+ # endif
217187 gettimeofday (& e_stop , 0 );
218188 dt_elapsed = (make_sec (& e_stop ) - tm -> start_elapsed );
219- #elif defined(_WIN32_WP )
220- dt_cpu = GetTickCount64 () / 1000 - tm -> start_cpu ;
221- dt_elapsed = GetTickCount64 () / 1000 - tm -> start_elapsed ;
222- #elif defined(_WIN32_WCE )
223- /* No GetProcessTimes() on WinCE. (Note CPU time will be bogus) */
224- dt_cpu = GetTickCount () / 1000 - tm -> start_cpu ;
225- dt_elapsed = GetTickCount () / 1000 - tm -> start_elapsed ;
226189#else
190+ /* Windows */
227191 HANDLE pid ;
228192 FILETIME t_create , t_exit , kst , ust ;
229193
0 commit comments