Module: libav
Branch: master
Commit: 6379900c533d1e556d484e57166873f3ab2505f5

Author:    Anton Khirnov <[email protected]>
Committer: Anton Khirnov <[email protected]>
Date:      Wed Jul 13 09:30:06 2011 +0200

Add a check for strptime().

It's an XSI extension, not available on some supported systems.

---

 configure           |    2 ++
 libavformat/utils.c |    6 ++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 02bcd09..596b603 100755
--- a/configure
+++ b/configure
@@ -1105,6 +1105,7 @@ HAVE_LIST="
     poll_h
     setrlimit
     strerror_r
+    strptime
     strtok_r
     struct_addrinfo
     struct_ipv6_mreq
@@ -2775,6 +2776,7 @@ check_func  mmap
 check_func  ${malloc_prefix}posix_memalign      && enable posix_memalign
 check_func  setrlimit
 check_func  strerror_r
+check_func  strptime
 check_func  strtok_r
 check_func_headers io.h setmode
 check_func_headers lzo/lzo1x.h lzo1x_999_compress
diff --git a/libavformat/utils.c b/libavformat/utils.c
index bb12e24..7e79922 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3887,7 +3887,13 @@ void ff_make_absolute_url(char *buf, int size, const 
char *base,
 
 int64_t ff_iso8601_to_unix_time(const char *datestr)
 {
+#if HAVE_STRPTIME
     struct tm time = {0};
     strptime(datestr, "%Y - %m - %dT%T", &time);
     return mktime(&time);
+#else
+    av_log(NULL, AV_LOG_WARNING, "strptime() unavailable on this system, 
cannot convert "
+                                 "the date string.\n");
+    return 0;
+#endif
 }

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to