[vlc-commits] thread: convert the ticks to nanoseconds using NS_FROM_VLC_TICK()
Steve Lhomme
git at videolan.org
Wed Jul 4 10:39:17 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jul 4 09:30:55 2018 +0200| [c9ace4119d11800ccd81e6900c0f12324b1b2dad] | committer: Steve Lhomme
thread: convert the ticks to nanoseconds using NS_FROM_VLC_TICK()
For the remaining ticks below the 1 second resolution
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c9ace4119d11800ccd81e6900c0f12324b1b2dad
---
src/darwin/thread.c | 2 +-
src/linux/thread.c | 2 +-
src/posix/thread.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/darwin/thread.c b/src/darwin/thread.c
index 7481ac7d49..d5f935464b 100644
--- a/src/darwin/thread.c
+++ b/src/darwin/thread.c
@@ -58,7 +58,7 @@ static pthread_once_t vlc_clock_once = PTHREAD_ONCE_INIT;
static struct timespec mtime_to_ts (vlc_tick_t date)
{
lldiv_t d = lldiv (date, CLOCK_FREQ);
- struct timespec ts = { d.quot, d.rem * (1000000000 / CLOCK_FREQ) };
+ struct timespec ts = { d.quot, NS_FROM_VLC_TICK( d.rem ) };
return ts;
}
diff --git a/src/linux/thread.c b/src/linux/thread.c
index b2c5eecfea..1d176b54f5 100644
--- a/src/linux/thread.c
+++ b/src/linux/thread.c
@@ -81,7 +81,7 @@ void vlc_addr_wait(void *addr, unsigned val)
bool vlc_addr_timedwait(void *addr, unsigned val, vlc_tick_t delay)
{
lldiv_t d = lldiv(delay, CLOCK_FREQ);
- struct timespec ts = { d.quot, d.rem * (1000000000 / CLOCK_FREQ) };
+ struct timespec ts = { d.quot, NS_FROM_VLC_TICK( d.rem ) };
return (vlc_futex_wait(addr, val, &ts) == 0 || errno != ETIMEDOUT);
}
diff --git a/src/posix/thread.c b/src/posix/thread.c
index 425bd32b69..4b8069b6be 100644
--- a/src/posix/thread.c
+++ b/src/posix/thread.c
@@ -64,7 +64,7 @@ static void vlc_clock_setup_once (void)
static struct timespec mtime_to_ts (vlc_tick_t date)
{
lldiv_t d = lldiv (date, CLOCK_FREQ);
- struct timespec ts = { d.quot, d.rem * (1000000000 / CLOCK_FREQ) };
+ struct timespec ts = { d.quot, NS_FROM_VLC_TICK( d.rem ) };
return ts;
}
More information about the vlc-commits
mailing list