X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmisc%2Fmtime.c;h=62409edd6b944bc7beb359c5b96f2c9c73e41845;hb=c2e56e6b8fe1c4b4ac7173faafd02edb37502a5c;hp=da0d8bfc374f0f4f5fe17760b8001cd88bcea91f;hpb=a4d304c79393f0acc9b4519792d62b7ebb72ea3f;p=vlc diff --git a/src/misc/mtime.c b/src/misc/mtime.c index da0d8bfc37..62409edd6b 100644 --- a/src/misc/mtime.c +++ b/src/misc/mtime.c @@ -2,7 +2,7 @@ * mtime.c: high resolution time management functions * Functions are prototyped in vlc_mtime.h. ***************************************************************************** - * Copyright (C) 1998-2007 the VideoLAN team + * Copyright (C) 1998-2007 VLC authors and VideoLAN * Copyright © 2006-2007 Rémi Denis-Courmont * $Id$ * @@ -10,19 +10,19 @@ * Rémi Denis-Courmont * Gisle Vanem * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** @@ -36,10 +36,8 @@ #include #include -#ifdef HAVE_UNISTD_H -# include -#endif -#if !defined (_POSIX_TIMERS) +#include +#if !defined (_POSIX_TIMERS) || defined (_WIN32) # define _POSIX_TIMERS (-1) #endif #if (_POSIX_TIMERS > 0) @@ -212,14 +210,14 @@ mtime_t date_Increment( date_t *p_date, uint32_t i_nb_samples ) */ mtime_t date_Decrement( date_t *p_date, uint32_t i_nb_samples ) { - mtime_t i_dividend = (mtime_t)i_nb_samples * 1000000 * p_date->i_divider_den; + mtime_t i_dividend = (mtime_t)i_nb_samples * CLOCK_FREQ * p_date->i_divider_den; p_date->date -= i_dividend / p_date->i_divider_num; unsigned i_rem_adjust = i_dividend % p_date->i_divider_num; if( p_date->i_remainder < i_rem_adjust ) { /* This is Bresenham algorithm. */ - assert( p_date->i_remainder > -p_date->i_divider_num); + assert( p_date->i_remainder < p_date->i_divider_num); p_date->date -= 1; p_date->i_remainder += p_date->i_divider_num; }