annotate os_support.c @ 885:da1d5db0ce5c libavformat

COSMETICS: Remove all trailing whitespace.
author diego
date Sat, 17 Dec 2005 18:14:38 +0000
parents 4f2b5cb90216
children edbe5c3717f9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
230
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
1 /*
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
2 * Various utilities for ffmpeg system
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
4 *
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
9 *
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
13 * Lesser General Public License for more details.
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
14 *
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
18 */
443
afbe3a5aae02 libavformat/os_support.c HAVE_LOCALTIME_R patch by ("Steven M. Schultz" <sms at 2BSD dot COM>)
michael
parents: 230
diff changeset
19 #include "config.h"
230
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
20 #include "avformat.h"
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
21 #ifdef CONFIG_WIN32
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
22 #include <sys/types.h>
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
23 #include <sys/timeb.h>
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
24 #elif defined(CONFIG_OS2)
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
25 #include <string.h>
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
26 #include <sys/time.h>
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
27 #else
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
28 #include <unistd.h>
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
29 #include <fcntl.h>
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
30 #include <sys/time.h>
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
31 #endif
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
32 #include <time.h>
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
33
580
michael
parents: 448
diff changeset
34 /**
michael
parents: 448
diff changeset
35 * gets the current time in micro seconds.
michael
parents: 448
diff changeset
36 */
230
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
37 int64_t av_gettime(void)
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
38 {
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
39 #ifdef CONFIG_WIN32
448
66217205fe4e cygwin patch by ("Sascha Sommer" <saschasommer at freenet dot de>)
michael
parents: 443
diff changeset
40 struct timeb tb;
230
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
41 _ftime(&tb);
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
42 return ((int64_t)tb.time * int64_t_C(1000) + (int64_t)tb.millitm) * int64_t_C(1000);
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
43 #else
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
44 struct timeval tv;
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
45 gettimeofday(&tv,NULL);
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
46 return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
47 #endif
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
48 }
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
49
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
50 #if !defined(HAVE_LOCALTIME_R)
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
51 struct tm *localtime_r(const time_t *t, struct tm *tp)
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
52 {
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
53 struct tm *l;
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 580
diff changeset
54
230
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
55 l = localtime(t);
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
56 if (!l)
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
57 return 0;
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
58 *tp = *l;
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
59 return tp;
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
60 }
9f4f4ca9f7b5 simpler strptime - added os_support.[ch] - moved localtime_r to os_support.c
bellard
parents:
diff changeset
61 #endif /* !defined(HAVE_LOCALTIME_R) */