SIP Witch 1.9.15
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
osip_time.h
Go to the documentation of this file.
1 /*
2  The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
3  Copyright (C) 2001-2012 Aymeric MOIZARD amoizard@antisip.com
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 #ifndef _OSIP_TIME_H_
21 #define _OSIP_TIME_H_
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Common time-related functions and data types */
28 
29 #if defined(_WIN32_WCE)
30  struct _timeb {
31  time_t time;
32  unsigned short millitm;
33  short timezone;
34  short dstflag;
35  };
36 
37 #endif
38 
39 /* struct timeval, as defined in <sys/time.h>, <winsock.h> or <winsock2.h> */
40  struct timeval;
41 
42 /* Time manipulation functions */
43  void add_gettimeofday (struct timeval *atv, int ms);
44  void min_timercmp (struct timeval *tv1, struct timeval *tv2);
45 
46 /* Operations on struct timeval */
47 #if !defined(timerisset)
48 #define osip_timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
49 #else
50 #define osip_timerisset(tvp) timerisset(tvp)
51 #endif
52 
53 #if !defined(timercmp)
54 #define osip_timercmp(a, b, CMP) \
55  (((a)->tv_sec == (b)->tv_sec) ? \
56  ((a)->tv_usec CMP (b)->tv_usec) : \
57  ((a)->tv_sec CMP (b)->tv_sec))
58 #else
59 #define osip_timercmp(tvp, uvp, cmp) timercmp(tvp,uvp,cmp)
60 #endif
61 
62 #if !defined(timerclear)
63 #define osip_timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
64 #else
65 #define osip_timerclear(tvp) timerclear(tvp)
66 #endif
67 
68  int osip_gettimeofday (struct timeval *tp, void *tz);
69  time_t osip_getsystemtime (time_t * t);
70  void osip_compensatetime (void);
71 
72 #ifdef __cplusplus
73 }
74 #endif
75 #endif
void osip_compensatetime(void)
void min_timercmp(struct timeval *tv1, struct timeval *tv2)
time_t osip_getsystemtime(time_t *t)
int osip_gettimeofday(struct timeval *tp, void *tz)
void add_gettimeofday(struct timeval *atv, int ms)