1 /*****************************************************************************
2 * clock_getres.c: POSIX clock_getres() replacement
3 *****************************************************************************
4 * Copyright © 2020 VLC authors and VideoLAN
6 * Author: Marvin Scholz <epirat07 at gmail dot com>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
29 #include <sys/errno.h>
30 #include <sys/types.h>
32 #include <mach/clock_types.h>
34 int clock_getres(clockid_t clock_id
, struct timespec
*tp
)
39 // For realtime, it is using gettimeofday and for
40 // the monotonic time it is relative to the system
41 // boot time. Both of these use timeval, which has
42 // at best microsecond precision.
44 tp
->tv_nsec
= NSEC_PER_USEC
;