Skip to content
Snippets Groups Projects
user avatar
Petter Reinholdtsen authored
The ftime method has been removed from POSIX and is depricated on Linux.
clock_gettime() work better on Linux, but is not available on Windows,
so fall back to ftime() if autotools/scons fail to detect clock_gettime().

Based on proposal in
xiph/opusfile!9.

Fixes the following compiler messages:

../../examples/dump_video.c: In function ‘main’:
../../examples/dump_video.c:490:5: warning: ‘ftime’ is deprecated: Use gettimeofday or clock_gettime instead [-Werror=deprecated-declarations]
  490 |     ftime(&start);
      |     ^~~~~
In file included from ../../examples/dump_video.c:40:
/usr/include/x86_64-linux-gnu/sys/timeb.h:29:12: note: declared here
   29 | extern int ftime (struct timeb *__timebuf)
      |            ^~~~~
../../examples/dump_video.c:491:5: warning: ‘ftime’ is deprecated: Use gettimeofday or clock_gettime instead [-Werror=deprecated-declarations]
  491 |     ftime(&last);
      |     ^~~~~
/usr/include/x86_64-linux-gnu/sys/timeb.h:29:12: note: declared here
   29 | extern int ftime (struct timeb *__timebuf)
      |            ^~~~~
../../examples/dump_video.c:505:13: warning: ‘ftime’ is deprecated: Use gettimeofday or clock_gettime instead [-Werror=deprecated-declarations]
  505 |             ftime(&after);
      |             ^~~~~
/usr/include/x86_64-linux-gnu/sys/timeb.h:29:12: note: declared here
   29 | extern int ftime (struct timeb *__timebuf)
      |            ^~~~~
794bf8c6
History
Name Last commit Last update