xref: /openbsd/usr.sbin/npppd/common/time_utils.h (revision 4dc6ca78)
1*4dc6ca78Sjsg /* $Id: time_utils.h,v 1.2 2010/09/23 04:47:40 jsg Exp $ */
2*4dc6ca78Sjsg 
3*4dc6ca78Sjsg /*-
4*4dc6ca78Sjsg  * Copyright (c) 2009 Internet Initiative Japan Inc.
5*4dc6ca78Sjsg  * All rights reserved.
6*4dc6ca78Sjsg  *
7*4dc6ca78Sjsg  * Redistribution and use in source and binary forms, with or without
8*4dc6ca78Sjsg  * modification, are permitted provided that the following conditions
9*4dc6ca78Sjsg  * are met:
10*4dc6ca78Sjsg  * 1. Redistributions of source code must retain the above copyright
11*4dc6ca78Sjsg  *    notice, this list of conditions and the following disclaimer.
12*4dc6ca78Sjsg  * 2. Redistributions in binary form must reproduce the above copyright
13*4dc6ca78Sjsg  *    notice, this list of conditions and the following disclaimer in the
14*4dc6ca78Sjsg  *    documentation and/or other materials provided with the distribution.
15*4dc6ca78Sjsg  *
16*4dc6ca78Sjsg  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17*4dc6ca78Sjsg  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*4dc6ca78Sjsg  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*4dc6ca78Sjsg  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20*4dc6ca78Sjsg  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*4dc6ca78Sjsg  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22*4dc6ca78Sjsg  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23*4dc6ca78Sjsg  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*4dc6ca78Sjsg  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*4dc6ca78Sjsg  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*4dc6ca78Sjsg  * SUCH DAMAGE.
27*4dc6ca78Sjsg  */
28*4dc6ca78Sjsg 
290fbf3537Syasuoka #ifndef TIME_UTIL_H
300fbf3537Syasuoka #define	TIME_UTIL_H	1
310fbf3537Syasuoka 
320fbf3537Syasuoka 
330fbf3537Syasuoka #define	get_monosec()		((time_t)(get_nanotime() / 1000000000LL))
340fbf3537Syasuoka 
350fbf3537Syasuoka #ifdef __cplusplus
360fbf3537Syasuoka extern "C" {
370fbf3537Syasuoka #endif
380fbf3537Syasuoka 
390fbf3537Syasuoka int64_t  get_nanotime (void);
400fbf3537Syasuoka 
410fbf3537Syasuoka 
420fbf3537Syasuoka #ifdef __cplusplus
430fbf3537Syasuoka }
440fbf3537Syasuoka #endif
450fbf3537Syasuoka 
460fbf3537Syasuoka #endif
47