]> git.sesse.net Git - vlc/blob - include/mtime.h
* ./src/interface/main.c: we no longer segfault if argc == 0.
[vlc] / include / mtime.h
1 /*****************************************************************************
2  * mtime.h: high resolution time management functions
3  * This header provides portable high precision time management functions,
4  * which should be the only ones used in other segments of the program, since
5  * functions like gettimeofday() and ftime() are not always supported.
6  * Most functions are declared as inline or as macros since they are only
7  * interfaces to system calls and have to be called frequently.
8  * 'm' stands for 'micro', since maximum resolution is the microsecond.
9  * Functions prototyped are implemented in interface/mtime.c.
10  *****************************************************************************
11  * Copyright (C) 1996, 1997, 1998, 1999, 2000 VideoLAN
12  * $Id: mtime.h,v 1.11 2002/04/24 00:36:24 sam Exp $
13  *
14  * Authors: Vincent Seguin <seguin@via.ecp.fr>
15  *
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 2 of the License, or
19  * (at your option) any later version.
20  * 
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, write to the Free Software
28  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
29  *****************************************************************************/
30
31 /*****************************************************************************
32  * LAST_MDATE: date which will never happen
33  *****************************************************************************
34  * This date can be used as a 'never' date, to mark missing events in a function
35  * supposed to return a date, such as nothing to display in a function
36  * returning the date of the first image to be displayed. It can be used in
37  * comparaison with other values: all existing dates will be earlier.
38  *****************************************************************************/
39 #define LAST_MDATE ((mtime_t)((u64)(-1)/2))
40
41 /*****************************************************************************
42  * MSTRTIME_MAX_SIZE: maximum possible size of mstrtime
43  *****************************************************************************
44  * This values is the maximal possible size of the string returned by the
45  * mstrtime() function, including '-' and the final '\0'. It should be used to
46  * allocate the buffer.
47  *****************************************************************************/
48 #define MSTRTIME_MAX_SIZE 22
49
50 /*****************************************************************************
51  * Prototypes
52  *****************************************************************************/
53 #ifndef __PLUGIN__
54 char *  mstrtime ( char *psz_buffer, mtime_t date );
55 mtime_t mdate    ( void );
56 void    mwait    ( mtime_t date );
57 void    msleep   ( mtime_t delay );
58 #else
59 #   define msleep    p_symbols->msleep
60 #   define mdate     p_symbols->mdate
61 #   define mstrtime  p_symbols->mstrtime
62 #endif
63