Commit b5d1414e authored by Simon Morlat's avatar Simon Morlat

change gettimeofday into ortp_gettimeofday (for windows)

parent 120e58e2
Installation Instructions
*************************
Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
Inc.
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
......@@ -226,11 +226,6 @@ order to use an ANSI C compiler:
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
HP-UX `make' updates targets which have the same time stamps as
their prerequisites, which makes it generally unusable when shipped
generated files such as `configure' are involved. Use GNU `make'
instead.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended
......
......@@ -107,7 +107,7 @@ int __ortp_thread_create(pthread_t *thread, pthread_attr_t *attr, void * (*routi
#define getSocketError() strerror(errno)
#define getSocketErrorCode() (errno)
#define ortp_gettimeofday(tv,tz) gettimeofday(tv,tz)
#define ortp_log10f(x) log10f(x)
......@@ -239,7 +239,7 @@ ORTP_PUBLIC const char *getWinSocketError(int error);
#ifdef __cplusplus
extern "C"{
#endif
ORTP_PUBLIC int gettimeofday (struct timeval *tv, void* tz);
ORTP_PUBLIC int ortp_gettimeofday (struct timeval *tv, void* tz);
#ifdef _WORKAROUND_MINGW32_BUGS
char * WSAAPI gai_strerror(int errnum);
#endif
......
......@@ -69,7 +69,7 @@ static mblk_t *simulate_bandwidth_limit(RtpSession *session, mblk_t *input){
#else
int overhead=IP_UDP_OVERHEAD;
#endif
gettimeofday(&current,NULL);
ortp_gettimeofday(&current,NULL);
if (sim->last_check.tv_sec==0){
sim->last_check=current;
......
......@@ -50,7 +50,7 @@ extern void av_profile_init(RtpProfile *profile);
static void init_random_number_generator(){
struct timeval t;
gettimeofday(&t,NULL);
ortp_gettimeofday(&t,NULL);
srandom(t.tv_usec+t.tv_sec);
}
......
......@@ -351,7 +351,7 @@ gettimeofday (struct timeval *tv, void *tz)
#else
int gettimeofday (struct timeval *tv, void* tz)
int ortp_gettimeofday (struct timeval *tv, void* tz)
{
union
{
......
......@@ -43,7 +43,7 @@ static uint32_t posix_timer_time=0; /*in milisecond */
void posix_timer_init()
{
posix_timer.state=RTP_TIMER_RUNNING;
gettimeofday(&orig,NULL);
ortp_gettimeofday(&orig,NULL);
posix_timer_time=0;
}
......@@ -54,7 +54,7 @@ void posix_timer_do()
{
int diff,time;
struct timeval tv;
gettimeofday(&cur,NULL);
ortp_gettimeofday(&cur,NULL);
time=((cur.tv_usec-orig.tv_usec)/1000 ) + ((cur.tv_sec-orig.tv_sec)*1000 );
if ( (diff=time-posix_timer_time)>50){
ortp_warning("Must catchup %i miliseconds.",diff);
......@@ -69,7 +69,7 @@ void posix_timer_do()
#else
select(0,NULL,NULL,NULL,&tv);
#endif
gettimeofday(&cur,NULL);
ortp_gettimeofday(&cur,NULL);
time=((cur.tv_usec-orig.tv_usec)/1000 ) + ((cur.tv_sec-orig.tv_sec)*1000 );
}
posix_timer_time+=POSIXTIMER_INTERVAL/1000;
......
......@@ -215,7 +215,7 @@ uint64_t ortp_timeval_to_ntp(const struct timeval *tv){
static void sender_info_init(sender_info_t *info, RtpSession *session){
struct timeval tv;
uint64_t ntp;
gettimeofday(&tv,NULL);
ortp_gettimeofday(&tv,NULL);
ntp=ortp_timeval_to_ntp(&tv);
info->ntp_timestamp_msw=htonl(ntp >>32);
info->ntp_timestamp_lsw=htonl(ntp & 0xFFFFFFFF);
......@@ -259,7 +259,7 @@ static void report_block_init(report_block_t *b, RtpSession *session){
if (stream->last_rcv_SR_time.tv_sec!=0){
struct timeval now;
double delay;
gettimeofday(&now,NULL);
ortp_gettimeofday(&now,NULL);
delay= (now.tv_sec-stream->last_rcv_SR_time.tv_sec)+ ((now.tv_usec-stream->last_rcv_SR_time.tv_usec)*1e-6);
delay= (delay*65536);
delay_snc_last_sr=(uint32_t) delay;
......@@ -309,7 +309,7 @@ static void extended_statistics( RtpSession *session, report_block_t * rb ) {
session->rtp.jitter_stats.max_jitter = jitter ;
gettimeofday( &now, NULL );
ortp_gettimeofday( &now, NULL );
session->rtp.jitter_stats.max_jitter_ts = ( now.tv_sec * 1000LL ) + ( now.tv_usec / 1000LL );
}
/* compute mean jitter buffer size */
......
......@@ -119,7 +119,7 @@ void rtp_session_rtp_parse(RtpSession *session, mblk_t *mp, uint32_t local_str_t
#ifndef PERF
/* Write down the last RTP/RTCP packet reception time. */
gettimeofday(&session->last_recv_time, NULL);
ortp_gettimeofday(&session->last_recv_time, NULL);
#endif
for (i=0;i<rtp->cc;i++)
......
......@@ -864,7 +864,7 @@ __rtp_session_sendm_with_ts (RtpSession * session, mblk_t *mp, uint32_t packet_t
if ((session->flags & RTP_SESSION_RECV_NOT_STARTED)
|| session->mode == RTP_SESSION_SENDONLY)
{
gettimeofday(&session->last_recv_time, NULL);
ortp_gettimeofday(&session->last_recv_time, NULL);
}
if (session->flags & RTP_SESSION_SCHEDULED)
{
......@@ -1069,7 +1069,7 @@ rtp_session_recvm_with_ts (RtpSession * session, uint32_t user_ts)
/* Set initial last_rcv_time to first recv time. */
if ((session->flags & RTP_SESSION_SEND_NOT_STARTED)
|| session->mode == RTP_SESSION_RECVONLY){
gettimeofday(&session->last_recv_time, NULL);
ortp_gettimeofday(&session->last_recv_time, NULL);
}
if (session->flags & RTP_SESSION_SCHEDULED)
{
......@@ -1643,7 +1643,7 @@ static float compute_bw(struct timeval *orig, unsigned int bytes){
float bw;
float time;
if (bytes==0) return 0;
gettimeofday(&current,NULL);
ortp_gettimeofday(&current,NULL);
time=(float)(current.tv_sec - orig->tv_sec) +
((float)(current.tv_usec - orig->tv_usec)*1e-6);
bw=((float)bytes)*8/(time+0.001);
......
......@@ -985,7 +985,7 @@ static void update_sent_bytes(RtpSession*s, int nbytes){
int overhead=IP_UDP_OVERHEAD;
#endif
if (s->rtp.sent_bytes==0){
gettimeofday(&s->rtp.send_bw_start,NULL);
ortp_gettimeofday(&s->rtp.send_bw_start,NULL);
}
s->rtp.sent_bytes+=nbytes+overhead;
}
......@@ -997,7 +997,7 @@ static void update_recv_bytes(RtpSession*s, int nbytes){
int overhead=IP_UDP_OVERHEAD;
#endif
if (s->rtp.recv_bytes==0){
gettimeofday(&s->rtp.recv_bw_start,NULL);
ortp_gettimeofday(&s->rtp.recv_bw_start,NULL);
}
s->rtp.recv_bytes+=nbytes+overhead;
}
......@@ -1356,7 +1356,7 @@ static int process_rtcp_packet( RtpSession *session, mblk_t *block, struct socka
const report_block_t *rb;
/* Getting the reception date from the main clock */
gettimeofday( &reception_date, NULL );
ortp_gettimeofday( &reception_date, NULL );
if (rtcp_is_SR(block) ) {
rtcp_sr_t *sr = (rtcp_sr_t *) rtcp;
......
......@@ -1387,7 +1387,7 @@ stunGetSystemTimeSecs(void)
time = (t.wHour*60+t.wMinute)*60+t.wSecond;
#else
struct timeval now;
gettimeofday( &now , NULL );
ortp_gettimeofday( &now , NULL );
/* assert( now ); */
time = now.tv_sec;
#endif
......
......@@ -79,7 +79,7 @@ static inline uint64_t convert_timeval_to_millis(struct timeval *t) {
static void check_timer(ZrtpContext *zrtpContext, OrtpZrtpContext *c) {
if (c->timerWillTriggerAt != 0) {
struct timeval t;
gettimeofday(&t,NULL);
ortp_gettimeofday(&t,NULL);
uint64_t now=convert_timeval_to_millis(&t);
if (now > c->timerWillTriggerAt) {
c->timerWillTriggerAt=0;
......@@ -237,7 +237,7 @@ static int32_t ozrtp_activateTimer (ZrtpContext* ctx, int32_t time ) {
return 0;
}
struct timeval t;
gettimeofday(&t,NULL);
ortp_gettimeofday(&t,NULL);
user_data(ctx)->timerWillTriggerAt=time+convert_timeval_to_millis(&t);
return 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment