Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
ebef9f5a
Commit
ebef9f5a
authored
Aug 24, 2014
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
time: Use clock_gettime if the monotonic clock is available
Signed-off-by:
Luca Barbato
<
lu_zero@gentoo.org
>
parent
65e78a2e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
configure
configure
+4
-0
time.c
libavutil/time.c
+8
-2
No files found.
configure
View file @
ebef9f5a
...
...
@@ -1432,6 +1432,7 @@ MATH_FUNCS="
SYSTEM_FUNCS
=
"
aligned_malloc
clock_gettime
closesocket
CommandLineToArgvW
CoTaskMemFree
...
...
@@ -4038,6 +4039,9 @@ check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
check_func
${
malloc_prefix
}
memalign
&&
enable
memalign
check_func
${
malloc_prefix
}
posix_memalign
&&
enable
posix_memalign
check_cpp_condition unistd.h
"defined(_POSIX_MONOTONIC_CLOCK)"
&&
check_func_headers time.h clock_gettime
||
{
check_func_headers time.h clock_gettime
-lrt
&&
add_extralibs
-lrt
;
}
check_func fcntl
check_func fork
check_func gethrtime
...
...
libavutil/time.c
View file @
ebef9f5a
...
...
@@ -21,7 +21,9 @@
#include <stddef.h>
#include <stdint.h>
#include <time.h>
#if HAVE_GETTIMEOFDAY
#if HAVE_CLOCK_GETTIME
#include <time.h>
#elif HAVE_GETTIMEOFDAY
#include <sys/time.h>
#endif
#if HAVE_UNISTD_H
...
...
@@ -36,7 +38,11 @@
int64_t
av_gettime
(
void
)
{
#if HAVE_GETTIMEOFDAY
#if HAVE_CLOCK_GETTIME
struct
timespec
ts
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
ts
);
return
(
int64_t
)
ts
.
tv_sec
*
100000
+
ts
.
tv_nsec
/
1000
;
#elif HAVE_GETTIMEOFDAY
struct
timeval
tv
;
gettimeofday
(
&
tv
,
NULL
);
return
(
int64_t
)
tv
.
tv_sec
*
1000000
+
tv
.
tv_usec
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment