2 * Various utilities for ffmpeg system
3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
4 * copyright (c) 2002 Francois Revol
6 * This file is part of FFmpeg.
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 #if defined(CONFIG_WINCE)
25 /* Skip includes on WinCE. */
26 #elif defined(__MINGW32__)
27 #include <sys/types.h>
28 #include <sys/timeb.h>
29 #elif defined(CONFIG_OS2)
40 * gets the current time in micro seconds.
42 int64_t av_gettime(void)
44 #if defined(CONFIG_WINCE)
45 return timeGetTime() * INT64_C(1000);
46 #elif defined(__MINGW32__)
49 return ((int64_t)tb.time * INT64_C(1000) + (int64_t)tb.millitm) * INT64_C(1000);
52 gettimeofday(&tv,NULL);
53 return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
57 #if !defined(CONFIG_WINCE) && !defined(HAVE_LOCALTIME_R)
58 struct tm *localtime_r(const time_t *t, struct tm *tp)
68 #endif /* !defined(CONFIG_WINCE) && !defined(HAVE_LOCALTIME_R) */
70 #if !defined(HAVE_INET_ATON) && defined(CONFIG_NETWORK)
73 #include "barpainet.h"
75 int inet_aton (const char * str, struct in_addr * add)
77 const char * pch = str;
78 unsigned int add1 = 0, add2 = 0, add3 = 0, add4 = 0;
81 pch = strpbrk(pch,".");
82 if (pch == 0 || ++pch == 0) goto done;
84 pch = strpbrk(pch,".");
85 if (pch == 0 || ++pch == 0) goto done;
87 pch = strpbrk(pch,".");
88 if (pch == 0 || ++pch == 0) goto done;
92 add->s_addr=(add4<<24)+(add3<<16)+(add2<<8)+add1;
96 #endif /* !defined(HAVE_INET_ATON) && defined(CONFIG_NETWORK) */