mirror of
https://gitlab.xiph.org/xiph/icecast-common.git
synced 2024-12-04 14:46:31 -05:00
Change long long to the more standard uint64_t. This will need to be
typedefed for some platforms. svn path=/trunk/timing/; revision=2190
This commit is contained in:
parent
5b7d386256
commit
27cbe839e9
@ -3,6 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -16,7 +17,7 @@
|
|||||||
/*
|
/*
|
||||||
* Returns milliseconds no matter what.
|
* Returns milliseconds no matter what.
|
||||||
*/
|
*/
|
||||||
long long timing_get_time(void)
|
uint64_t timing_get_time(void)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
return timeGetTime();
|
return timeGetTime();
|
||||||
@ -25,16 +26,16 @@ long long timing_get_time(void)
|
|||||||
|
|
||||||
gettimeofday(&mtv, NULL);
|
gettimeofday(&mtv, NULL);
|
||||||
|
|
||||||
return (long long)(mtv.tv_sec) * 1000 + (long long)(mtv.tv_usec) / 1000;
|
return (uint64_t)(mtv.tv_sec) * 1000 + (uint64_t)(mtv.tv_usec) / 1000;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void timing_sleep(long long sleeptime)
|
void timing_sleep(uint64_t sleeptime)
|
||||||
{
|
{
|
||||||
struct timeval sleeper;
|
struct timeval sleeper;
|
||||||
|
|
||||||
sleeper.tv_sec = 0;
|
sleeper.tv_sec = 0;
|
||||||
sleeper.tv_usec = sleeptime * 1000;
|
sleeper.tv_usec = sleeptime * 1000;
|
||||||
|
|
||||||
select(0, NULL, NULL, NULL, &sleeper);
|
select(1, NULL, NULL, NULL, &sleeper);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
#ifndef __TIMING_H__
|
#ifndef __TIMING_H__
|
||||||
#define __TIMING_H__
|
#define __TIMING_H__
|
||||||
|
|
||||||
long long timing_get_time(void);
|
#include <stdint.h>
|
||||||
void timing_sleep(long long sleeptime);
|
|
||||||
|
uint64_t timing_get_time(void);
|
||||||
|
void timing_sleep(uint64_t sleeptime);
|
||||||
|
|
||||||
#endif /* __TIMING_H__ */
|
#endif /* __TIMING_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user