1139825Simp/*- 271413Swollman * Copyright (c) 1982, 1986, 1993 371413Swollman * The Regents of the University of California. All rights reserved. 471413Swollman * 571413Swollman * Redistribution and use in source and binary forms, with or without 671413Swollman * modification, are permitted provided that the following conditions 771413Swollman * are met: 871413Swollman * 1. Redistributions of source code must retain the above copyright 971413Swollman * notice, this list of conditions and the following disclaimer. 1071413Swollman * 2. Redistributions in binary form must reproduce the above copyright 1171413Swollman * notice, this list of conditions and the following disclaimer in the 1271413Swollman * documentation and/or other materials provided with the distribution. 1371413Swollman * 4. Neither the name of the University nor the names of its contributors 1471413Swollman * may be used to endorse or promote products derived from this software 1571413Swollman * without specific prior written permission. 1671413Swollman * 1771413Swollman * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1871413Swollman * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1971413Swollman * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2071413Swollman * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2171413Swollman * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2271413Swollman * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2371413Swollman * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2471413Swollman * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2571413Swollman * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2671413Swollman * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2771413Swollman * SUCH DAMAGE. 2871413Swollman * 2971413Swollman * @(#)time.h 8.5 (Berkeley) 5/4/95 3071413Swollman * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp 3171413Swollman * $FreeBSD$ 3271413Swollman */ 3371413Swollman 3471413Swollman#ifndef _SYS_TIMESPEC_H_ 3571413Swollman#define _SYS_TIMESPEC_H_ 3671413Swollman 37205792Sed#include <sys/cdefs.h> 38205792Sed#include <sys/_timespec.h> 3971413Swollman 4071413Swollman#if __BSD_VISIBLE 4171413Swollman#define TIMEVAL_TO_TIMESPEC(tv, ts) \ 4271413Swollman do { \ 4371413Swollman (ts)->tv_sec = (tv)->tv_sec; \ 4471413Swollman (ts)->tv_nsec = (tv)->tv_usec * 1000; \ 4571413Swollman } while (0) 4671413Swollman#define TIMESPEC_TO_TIMEVAL(tv, ts) \ 4771413Swollman do { \ 4871413Swollman (tv)->tv_sec = (ts)->tv_sec; \ 4971413Swollman (tv)->tv_usec = (ts)->tv_nsec / 1000; \ 5071413Swollman } while (0) 5171413Swollman 5271413Swollman#endif /* __BSD_VISIBLE */ 5371413Swollman 54151576Sdavidxu/* 55151576Sdavidxu * Structure defined by POSIX.1b to be like a itimerval, but with 56151576Sdavidxu * timespecs. Used in the timer_*() system calls. 57151576Sdavidxu */ 58151576Sdavidxustruct itimerspec { 59151576Sdavidxu struct timespec it_interval; 60151576Sdavidxu struct timespec it_value; 61151576Sdavidxu}; 62151576Sdavidxu 6371413Swollman#endif /* _SYS_TIMESPEC_H_ */ 64