00001 /***************************************************************************** 00002 * vlc_mtime.h: high resolution time management functions 00003 ***************************************************************************** 00004 * This header provides portable high precision time management functions, 00005 * which should be the only ones used in other segments of the program, since 00006 * functions like gettimeofday() and ftime() are not always supported. 00007 * Most functions are declared as inline or as macros since they are only 00008 * interfaces to system calls and have to be called frequently. 00009 * 'm' stands for 'micro', since maximum resolution is the microsecond. 00010 * Functions prototyped are implemented in interface/mtime.c. 00011 ***************************************************************************** 00012 * Copyright (C) 1996, 1997, 1998, 1999, 2000 VLC authors and VideoLAN 00013 * $Id: ab89a972120c8ee3f45d9823994eac584f8fe527 $ 00014 * 00015 * Authors: Vincent Seguin <seguin@via.ecp.fr> 00016 * 00017 * This program is free software; you can redistribute it and/or modify it 00018 * under the terms of the GNU Lesser General Public License as published by 00019 * the Free Software Foundation; either version 2.1 of the License, or 00020 * (at your option) any later version. 00021 * 00022 * This program is distributed in the hope that it will be useful, 00023 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00024 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00025 * GNU Lesser General Public License for more details. 00026 * 00027 * You should have received a copy of the GNU Lesser General Public License 00028 * along with this program; if not, write to the Free Software Foundation, 00029 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 00030 *****************************************************************************/ 00031 00032 #ifndef __VLC_MTIME_H 00033 # define __VLC_MTIME_H 1 00034 00035 /***************************************************************************** 00036 * LAST_MDATE: date which will never happen 00037 ***************************************************************************** 00038 * This date can be used as a 'never' date, to mark missing events in a function 00039 * supposed to return a date, such as nothing to display in a function 00040 * returning the date of the first image to be displayed. It can be used in 00041 * comparaison with other values: all existing dates will be earlier. 00042 *****************************************************************************/ 00043 #define LAST_MDATE ((mtime_t)((uint64_t)(-1)/2)) 00044 00045 /***************************************************************************** 00046 * MSTRTIME_MAX_SIZE: maximum possible size of mstrtime 00047 ***************************************************************************** 00048 * This values is the maximal possible size of the string returned by the 00049 * mstrtime() function, including '-' and the final '\0'. It should be used to 00050 * allocate the buffer. 00051 *****************************************************************************/ 00052 #define MSTRTIME_MAX_SIZE 22 00053 00054 /***************************************************************************** 00055 * Prototypes 00056 *****************************************************************************/ 00057 VLC_API char * mstrtime( char *psz_buffer, mtime_t date ); 00058 VLC_API char * secstotimestr( char *psz_buffer, int32_t secs ); 00059 00060 /***************************************************************************** 00061 * date_t: date incrementation without long-term rounding errors 00062 *****************************************************************************/ 00063 struct date_t 00064 { 00065 mtime_t date; 00066 uint32_t i_divider_num; 00067 uint32_t i_divider_den; 00068 uint32_t i_remainder; 00069 }; 00070 00071 VLC_API void date_Init( date_t *, uint32_t, uint32_t ); 00072 VLC_API void date_Change( date_t *, uint32_t, uint32_t ); 00073 VLC_API void date_Set( date_t *, mtime_t ); 00074 VLC_API mtime_t date_Get( const date_t * ); 00075 VLC_API void date_Move( date_t *, mtime_t ); 00076 VLC_API mtime_t date_Increment( date_t *, uint32_t ); 00077 VLC_API mtime_t date_Decrement( date_t *, uint32_t ); 00078 VLC_API uint64_t NTPtime64( void ); 00079 #endif /* !__VLC_MTIME_ */
1.7.1