Opened 6 years ago
Closed 6 years ago
#7486 closed defect (needs_more_info)
definition conflict of gmtime in time_internal.h
Reported by: | cortexembed | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avutil |
Version: | git-master | Keywords: | gmtime |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
When compiling ffmpeg on an embedded platform without gmtime support, compiling ffmpeg fails at:
./libavutil/time_internal.h:26:26: Fehler: Statische Deklaration von »gmtime_r« folgt nicht-statischer Deklaration
static inline struct tm *gmtime_r(const time_t* clock, struct tm *result)
Removing the "static" on line 26 (and 48 also) to only "inline struct tm *gmtime_rgmtime_r(const time_t* clock, struct tm *result) solves the issue.
Change History (3)
comment:2 by , 6 years ago
Keywords: | time_internal.h removed |
---|---|
Priority: | minor → normal |
Please either explain how I can reproduce the issue you see (this includes at least the configure line you used and information about your toolchain) or send a patch - made with git format-patch
- to the FFmpeg development mailing list, both patches and patch suggestions are ignored here.
comment:3 by , 6 years ago
Resolution: | → needs_more_info |
---|---|
Status: | new → closed |
I also stronly recommend to move function bodies from libavutil/time._internal.h into libavutil/time.c
Here is a possbile patch:
diff --git a/libavutil/time.c b/libavutil/time.c
index afa6658aa6..cd3a0fe1f0 100644
--- a/libavutil/time.c
+++ b/libavutil/time.c
@@ -96,3 +96,28 @@ int av_usleep(unsigned usec)
+
+#if !HAVE_GMTIME_R && !defined(gmtime_r)
+inline struct tm *gmtime_r(const time_t* clock, struct tm *result)
+{
+ struct tm *ptr = gmtime(clock);
+ if (!ptr)
+ return NULL;
+ *result = *ptr;
+ return result;
+}
+#endif
+
+
+#if !HAVE_LOCALTIME_R && !defined(localtime_r)
+inline struct tm *localtime_r(const time_t* clock, struct tm *result)
+{
+ struct tm *ptr = localtime(clock);
+ if (!ptr)
+ return NULL;
+ *result = *ptr;
+ return result;
+}
+#endif
diff --git a/libavutil/time_internal.h b/libavutil/time_internal.h
index 612a75a041..2dfc9c08dc 100644
--- a/libavutil/time_internal.h
+++ b/libavutil/time_internal.h
@@ -23,25 +23,11 @@
-static inline struct tm *gmtime_r(const time_t* clock, struct tm *result)
-{
-}
+struct tm *gmtime_r(const time_t* clock, struct tm *result);
-static inline struct tm *localtime_r(const time_t* clock, struct tm *result)
-{
-}
+struct tm *localtime_r(const time_t* clock, struct tm *result);