Fixed timing on weird systems.
This commit is contained in:
parent
c019dc6e9f
commit
74312b2e51
3 changed files with 7 additions and 5 deletions
|
@ -2,7 +2,7 @@ AM_CPPFLAGS = $(global_CFLAGS)
|
||||||
|
|
||||||
lib_LTLIBRARIES=libmist-1.0.la
|
lib_LTLIBRARIES=libmist-1.0.la
|
||||||
libmist_1_0_la_SOURCES=amf.h amf.cpp auth.h auth.cpp base64.h base64.cpp config.h config.cpp crypto.h crypto.cpp dtsc.h dtsc.cpp flv_tag.h flv_tag.cpp http_parser.h http_parser.cpp json.h json.cpp procs.h procs.cpp rtmpchunks.h rtmpchunks.cpp socket.h socket.cpp mp4.h mp4.cpp ftp.h ftp.cpp filesystem.h filesystem.cpp stream.h stream.cpp timing.h timing.cpp
|
libmist_1_0_la_SOURCES=amf.h amf.cpp auth.h auth.cpp base64.h base64.cpp config.h config.cpp crypto.h crypto.cpp dtsc.h dtsc.cpp flv_tag.h flv_tag.cpp http_parser.h http_parser.cpp json.h json.cpp procs.h procs.cpp rtmpchunks.h rtmpchunks.cpp socket.h socket.cpp mp4.h mp4.cpp ftp.h ftp.cpp filesystem.h filesystem.cpp stream.h stream.cpp timing.h timing.cpp
|
||||||
libmist_1_0_la_LIBADD=-lssl -lcrypto
|
libmist_1_0_la_LIBADD=-lssl -lcrypto -lrt
|
||||||
libmist_1_0_la_LDFLAGS = -version-info 2:0:0
|
libmist_1_0_la_LDFLAGS = -version-info 2:0:0
|
||||||
|
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
|
|
|
@ -7,5 +7,5 @@ Name: Mist
|
||||||
Description: Mist Streaming Media Library
|
Description: Mist Streaming Media Library
|
||||||
Requires: openssl
|
Requires: openssl
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
Libs: -L${libdir} -lmist-1.0 -lssl -lcrypto
|
Libs: -L${libdir} -lmist-1.0 -lssl -lcrypto -lrt
|
||||||
Cflags: -I${includedir}/mist-1.0 -I${libdir}/mist-1.0/include
|
Cflags: -I${includedir}/mist-1.0 -I${libdir}/mist-1.0/include
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
/// Sleeps for the indicated amount of milliseconds or longer.
|
/// Sleeps for the indicated amount of milliseconds or longer.
|
||||||
void Util::sleep(int ms){
|
void Util::sleep(int ms){
|
||||||
|
if (ms < 0){return;}
|
||||||
|
if (ms > 10000){return;}
|
||||||
struct timespec T;
|
struct timespec T;
|
||||||
T.tv_sec = ms/1000;
|
T.tv_sec = ms/1000;
|
||||||
T.tv_nsec = 1000*(ms%1000);
|
T.tv_nsec = 1000*(ms%1000);
|
||||||
|
@ -16,9 +18,9 @@ void Util::sleep(int ms){
|
||||||
/// Gets the current time in milliseconds.
|
/// Gets the current time in milliseconds.
|
||||||
long long int Util::getMS(){
|
long long int Util::getMS(){
|
||||||
/// \todo Possibly change to use clock_gettime - needs -lrt though...
|
/// \todo Possibly change to use clock_gettime - needs -lrt though...
|
||||||
timeval t;
|
struct timespec t;
|
||||||
gettimeofday(&t, 0);
|
clock_gettime(CLOCK_REALTIME, &t);
|
||||||
return t.tv_sec * 1000 + t.tv_usec/1000;
|
return ((long long int)t.tv_sec) * 1000 + t.tv_nsec/1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the amount of seconds since 01/01/1970.
|
/// Gets the amount of seconds since 01/01/1970.
|
||||||
|
|
Loading…
Add table
Reference in a new issue