OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [sys/] [linux/] [sys/] [time.h] - Blame information for rev 158

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* libc/sys/linux/sys/time.h - Time handling */
2
 
3
/* Written 2000 by Werner Almesberger */
4
 
5
/*
6
 * Copyright (c) 1982, 1986, 1993
7
 *      The Regents of the University of California.  All rights reserved.
8
 *
9
 * Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions
11
 * are met:
12
 * 1. Redistributions of source code must retain the above copyright
13
 *    notice, this list of conditions and the following disclaimer.
14
 * 2. Redistributions in binary form must reproduce the above copyright
15
 *    notice, this list of conditions and the following disclaimer in the
16
 *    documentation and/or other materials provided with the distribution.
17
 * 3. All advertising materials mentioning features or use of this software
18
 *    must display the following acknowledgement:
19
 *      This product includes software developed by the University of
20
 *      California, Berkeley and its contributors.
21
 * 4. Neither the name of the University nor the names of its contributors
22
 *    may be used to endorse or promote products derived from this software
23
 *    without specific prior written permission.
24
 *
25
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35
 * SUCH DAMAGE.
36
 *
37
 *      @(#)time.h      8.5 (Berkeley) 5/4/95
38
 * $FreeBSD: src/sys/sys/time.h,v 1.56 2002/05/05 04:33:09 bde Exp $
39
 */
40
 
41
#ifndef _SYS_TIME_H
42
#define _SYS_TIME_H
43
 
44
#include <sys/types.h>
45
#include <sys/linux_time.h>
46
 
47
/* Macros for converting between `struct timeval' and `struct timespec'.  */
48
# define TIMEVAL_TO_TIMESPEC(tv, ts) {                                   \
49
        (ts)->tv_sec = (tv)->tv_sec;                                    \
50
        (ts)->tv_nsec = (tv)->tv_usec * 1000;                           \
51
}
52
# define TIMESPEC_TO_TIMEVAL(tv, ts) {                                   \
53
        (tv)->tv_sec = (ts)->tv_sec;                                    \
54
        (tv)->tv_usec = (ts)->tv_nsec / 1000;                           \
55
}
56
 
57
/* Convenience macros for operations on timevals.
58
   NOTE: `timercmp' does not work for >= or <=.  */
59
# define timerisset(tvp)        ((tvp)->tv_sec || (tvp)->tv_usec)
60
# define timerclear(tvp)        ((tvp)->tv_sec = (tvp)->tv_usec = 0)
61
# define timercmp(a, b, CMP)                                                  \
62
  (((a)->tv_sec == (b)->tv_sec) ?                                             \
63
   ((a)->tv_usec CMP (b)->tv_usec) :                                          \
64
   ((a)->tv_sec CMP (b)->tv_sec))
65
# define timeradd(a, b, result)                                               \
66
  do {                                                                        \
67
    (result)->tv_sec = (a)->tv_sec + (b)->tv_sec;                             \
68
    (result)->tv_usec = (a)->tv_usec + (b)->tv_usec;                          \
69
    if ((result)->tv_usec >= 1000000)                                         \
70
      {                                                                       \
71
        ++(result)->tv_sec;                                                   \
72
        (result)->tv_usec -= 1000000;                                         \
73
      }                                                                       \
74
  } while (0)
75
# define timersub(a, b, result)                                               \
76
  do {                                                                        \
77
    (result)->tv_sec = (a)->tv_sec - (b)->tv_sec;                             \
78
    (result)->tv_usec = (a)->tv_usec - (b)->tv_usec;                          \
79
    if ((result)->tv_usec < 0) {                                       \
80
      --(result)->tv_sec;                                                     \
81
      (result)->tv_usec += 1000000;                                           \
82
    }                                                                         \
83
  } while (0)
84
/* --- redundant stuff below --- */
85
 
86
#include <_ansi.h>
87
 
88
int _EXFUN(gettimeofday, (struct timeval *__p, struct timezone *__z));
89
int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *));
90
int _EXFUN(utimes, (const char *__path, const struct timeval __tvp[2]));
91
int _EXFUN(getitimer, (int __which, struct itimerval *__value));
92
int _EXFUN(setitimer, (int __which, const struct itimerval *__value,
93
                                        struct itimerval *__ovalue));
94
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.