1/*- 2 * Copyright (c) 2023 Dag-Erling Sm��rgrav 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <time.h> 8 9int 10timespec_getres(struct timespec *ts, int base) 11{ 12 13 switch (base) { 14 case TIME_UTC: 15 if (clock_getres(CLOCK_REALTIME, ts) == 0) 16 return (base); 17 break; 18 case TIME_MONOTONIC: 19 if (clock_getres(CLOCK_MONOTONIC, ts) == 0) 20 return (base); 21 break; 22 } 23 return (0); 24} 25