Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
2987f40f
Commit
2987f40f
authored
May 25, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also implement msleep() wrt _POSIX_MONOTONIC_CLOCK
parent
c21acbbc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
src/misc/mtime.c
src/misc/mtime.c
+13
-4
No files found.
src/misc/mtime.c
View file @
2987f40f
...
@@ -190,13 +190,14 @@ mtime_t mdate( void )
...
@@ -190,13 +190,14 @@ mtime_t mdate( void )
#elif defined (HAVE_CLOCK_GETTIME)
#elif defined (HAVE_CLOCK_GETTIME)
struct
timespec
ts
;
struct
timespec
ts
;
# if (_POSIX_MONOTONIC_CLOCK >= 0)
# if (_POSIX_MONOTONIC_CLOCK
- 0
>= 0)
/* Try to use POSIX monotonic clock if available */
/* Try to use POSIX monotonic clock if available */
if
(
clock_gettime
(
CLOCK_MONOTONIC
,
&
ts
)
)
if
(
clock_gettime
(
CLOCK_MONOTONIC
,
&
ts
)
)
# endif
# endif
/* Run-time fallback to real-time clock (always available) */
/* Run-time fallback to real-time clock (always available) */
(
void
)
clock_gettime
(
CLOCK_REALTIME
,
&
ts
);
(
void
)
clock_gettime
(
CLOCK_REALTIME
,
&
ts
);
fprintf
(
stderr
,
"%ld
\n
"
,
(
mtime_t
)((
ts
.
tv_sec
*
1000000
)
+
(
ts
.
tv_nsec
/
1000
)));
return
(
ts
.
tv_sec
*
1000000
)
+
(
ts
.
tv_nsec
/
1000
);
return
(
ts
.
tv_sec
*
1000000
)
+
(
ts
.
tv_nsec
/
1000
);
#else
#else
struct
timeval
tv_date
;
struct
timeval
tv_date
;
...
@@ -257,10 +258,10 @@ void mwait( mtime_t date )
...
@@ -257,10 +258,10 @@ void mwait( mtime_t date )
ts
.
tv_sec
=
d
.
quot
;
ts
.
tv_sec
=
d
.
quot
;
ts
.
tv_nsec
=
d
.
rem
*
1000
;
ts
.
tv_nsec
=
d
.
rem
*
1000
;
# if (_POSIX_MONOTONIC_CLOCK >= 0)
# if (_POSIX_MONOTONIC_CLOCK
- 0
>= 0)
if
(
clock_nanosleep
(
CLOCK_MONOTONIC
,
0
/*TIMER_ABSTIME*/
,
&
ts
,
NULL
)
)
if
(
clock_nanosleep
(
CLOCK_MONOTONIC
,
0
,
&
ts
,
NULL
)
)
# endif
# endif
(
void
)
clock_nanosleep
(
CLOCK_REALTIME
,
0
,
&
ts
,
NULL
);
clock_nanosleep
(
CLOCK_REALTIME
,
0
,
&
ts
,
NULL
);
#else
#else
struct
timeval
tv_date
;
struct
timeval
tv_date
;
...
@@ -330,6 +331,14 @@ void msleep( mtime_t delay )
...
@@ -330,6 +331,14 @@ void msleep( mtime_t delay )
#elif defined( WIN32 ) || defined( UNDER_CE )
#elif defined( WIN32 ) || defined( UNDER_CE )
Sleep
(
(
int
)
(
delay
/
1000
)
);
Sleep
(
(
int
)
(
delay
/
1000
)
);
#elif defined( HAVE_CLOCK_GETTIME )
ldiv_t
d
=
ldiv
(
delay
,
1000000
);
struct
timespec
ts
=
{
d
.
quot
,
d
.
rem
*
1000
};
# if (_POSIX_CLOCK_MONOTONIC - 0 >= 0)
if
(
clock_nanosleep
(
CLOCK_MONOTONIC
,
0
,
&
ts
,
NULL
)
)
# endif
clock_nanosleep
(
CLOCK_REALTIME
,
0
,
&
ts
,
NULL
);
#elif defined( HAVE_NANOSLEEP )
#elif defined( HAVE_NANOSLEEP )
struct
timespec
ts_delay
;
struct
timespec
ts_delay
;
...
...
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