Return a signed integer from altime_get

This commit is contained in:
Chris Robinson 2018-11-27 10:41:07 -08:00
parent ff6dda06ad
commit 3f745be1dc
3 changed files with 10 additions and 10 deletions

View File

@ -452,7 +452,6 @@ int main(int argc, char **argv)
EFX_REVERB_PRESET_CARPETEDHALLWAY, EFX_REVERB_PRESET_CARPETEDHALLWAY,
EFX_REVERB_PRESET_BATHROOM EFX_REVERB_PRESET_BATHROOM
}; };
unsigned int basetime;
ALCdevice *device = NULL; ALCdevice *device = NULL;
ALCcontext *context = NULL; ALCcontext *context = NULL;
ALuint effects[2] = { 0, 0 }; ALuint effects[2] = { 0, 0 };
@ -463,6 +462,7 @@ int main(int argc, char **argv)
ALCint num_sends = 0; ALCint num_sends = 0;
ALenum state = AL_INITIAL; ALenum state = AL_INITIAL;
ALfloat direct_gain = 1.0f; ALfloat direct_gain = 1.0f;
int basetime = 0;
int loops = 0; int loops = 0;
/* Print out usage if no arguments were specified */ /* Print out usage if no arguments were specified */
@ -640,7 +640,7 @@ int main(int argc, char **argv)
/* Play the sound for a while. */ /* Play the sound for a while. */
alSourcePlay(source); alSourcePlay(source);
do { do {
unsigned int curtime; int curtime;
ALfloat timediff; ALfloat timediff;
/* Start a batch update, to ensure all changes apply simultaneously. */ /* Start a batch update, to ensure all changes apply simultaneously. */

View File

@ -124,17 +124,17 @@ const char *FormatName(ALenum format)
#include <windows.h> #include <windows.h>
#include <mmsystem.h> #include <mmsystem.h>
unsigned int altime_get(void) int altime_get(void)
{ {
static unsigned int start_time = 0; static int start_time = 0;
unsigned int cur_time; int cur_time;
union { union {
FILETIME ftime; FILETIME ftime;
ULARGE_INTEGER ulint; ULARGE_INTEGER ulint;
} systime; } systime;
GetSystemTimeAsFileTime(&systime.ftime); GetSystemTimeAsFileTime(&systime.ftime);
/* FILETIME is in 100-nanosecond units, or 1/10th of a microsecond. */ /* FILETIME is in 100-nanosecond units, or 1/10th of a microsecond. */
cur_time = (unsigned int)(systime.ulint.QuadPart/10000); cur_time = (int)(systime.ulint.QuadPart/10000);
if(!start_time) if(!start_time)
start_time = cur_time; start_time = cur_time;
@ -152,10 +152,10 @@ void al_nssleep(unsigned long nsec)
#include <unistd.h> #include <unistd.h>
#include <time.h> #include <time.h>
unsigned int altime_get(void) int altime_get(void)
{ {
static unsigned int start_time = 0u; static int start_time = 0u;
unsigned int cur_time; int cur_time;
#if _POSIX_TIMERS > 0 #if _POSIX_TIMERS > 0
struct timespec ts; struct timespec ts;

View File

@ -17,7 +17,7 @@ int InitAL(char ***argv, int *argc);
void CloseAL(void); void CloseAL(void);
/* Cross-platform timeget and sleep functions. */ /* Cross-platform timeget and sleep functions. */
unsigned int altime_get(void); int altime_get(void);
void al_nssleep(unsigned long nsec); void al_nssleep(unsigned long nsec);
#ifdef __cplusplus #ifdef __cplusplus