Ignore:
Timestamp:
May 19, 2003, 4:41:00 AM (22 years ago)
Author:
bird
Message:

#434: Initial tcpip header merges.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/sys/time.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1 /* sys/time.h (emx+gcc) */
     1/* - modified for gcc/os2 by bird 2003
     2 *
     3 * Copyright (c) 1982, 1986, 1993
     4 *      The Regents of the University of California.  All rights reserved.
     5 *
     6 * Redistribution and use in source and binary forms, with or without
     7 * modification, are permitted provided that the following conditions
     8 * are met:
     9 * 1. Redistributions of source code must retain the above copyright
     10 *    notice, this list of conditions and the following disclaimer.
     11 * 2. Redistributions in binary form must reproduce the above copyright
     12 *    notice, this list of conditions and the following disclaimer in the
     13 *    documentation and/or other materials provided with the distribution.
     14 * 3. All advertising materials mentioning features or use of this software
     15 *    must display the following acknowledgement:
     16 *      This product includes software developed by the University of
     17 *      California, Berkeley and its contributors.
     18 * 4. Neither the name of the University nor the names of its contributors
     19 *    may be used to endorse or promote products derived from this software
     20 *    without specific prior written permission.
     21 *
     22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32 * SUCH DAMAGE.
     33 *
     34 *      @(#)time.h      8.5 (Berkeley) 5/4/95
     35  */
    236
    3 #ifndef _SYS_TIME_H
    4 #define _SYS_TIME_H
     37#ifndef _SYS_TIME_H_
     38#define _SYS_TIME_H_
    539
    640#include <time.h>
     41#include <sys/types.h>
    742
    843#if defined (__cplusplus)
     
    1247#if !defined (_TIMEVAL)
    1348#define _TIMEVAL
     49/** gettimeofday return structure */
    1450struct timeval
    1551{
     52  /** seconds */
    1653  long tv_sec;
     54  /** and microseconds */
    1755  long tv_usec;
    1856};
     
    2159#if !defined (_TIMEZONE)
    2260#define _TIMEZONE
     61/** Timezone information */
    2362struct timezone
    2463{
     64  /** minutes west of Greenwich */
    2565  int tz_minuteswest;
     66  /** type of dst correction. */
    2667  int tz_dsttime;
    2768};
    2869#endif
    2970
    30 int utimes (__const__ char *, __const__ struct timeval *);
    31 int gettimeofday (struct timeval *, struct timezone *);
    32 int settimeofday (__const__ struct timeval *, __const__ struct timezone *);
     71#if !defined(TCPV40HDRS) && !defined(DST_NONE)
     72#define DST_NONE    0   /* not on dst */
     73#define DST_USA     1   /* USA style dst. */
     74#define DST_AUST    2   /* Australian style dst. */
     75#define DST_WET     3   /* Western European dst. */
     76#define DST_MET     4   /* Middle European dst. */
     77#define DST_EET     5   /* Eastern European dst. */
     78#define DST_CAN     6   /* Canada. */
     79#endif  /* !TCPV40HDRS */
     80
     81#ifndef TCPV40HDRS
     82#pragma pack(4)
     83/** POSIX.4 version of timeval. */
     84struct timespec {
     85        time_t  ts_sec;         /* seconds */
     86        long    ts_nsec;        /* and nanoseconds */
     87};
     88#pragma pack()
     89#define TIMEVAL_TO_TIMESPEC(tv, ts) {                                   \
     90        (ts)->ts_sec = (tv)->tv_sec;                                    \
     91        (ts)->ts_nsec = (tv)->tv_usec * 1000;                           \
     92}
     93#define TIMESPEC_TO_TIMEVAL(tv, ts) {                                   \
     94        (tv)->tv_sec = (ts)->ts_sec;                                    \
     95        (tv)->tv_usec = (ts)->ts_nsec / 1000;                           \
     96}
     97
     98/* Operations on timevals. */
     99#define timerclear(tvp)         ((tvp)->tv_sec = (tvp)->tv_usec = 0)
     100#define timerisset(tvp)         ((tvp)->tv_sec || (tvp)->tv_usec)
     101#ifndef timercmp
     102#define timercmp(tvp, uvp, cmp)                                         \
     103        (((tvp)->tv_sec == (uvp)->tv_sec) ?                             \
     104            ((tvp)->tv_usec cmp (uvp)->tv_usec) :                       \
     105            ((tvp)->tv_sec cmp (uvp)->tv_sec))
     106#endif
     107#ifndef timeradd
     108#define timeradd(tvp, uvp, vvp)                                         \
     109        do {                                                            \
     110                (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec;          \
     111                (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec;       \
     112                if ((vvp)->tv_usec >= 1000000) {                        \
     113                        (vvp)->tv_sec++;                                \
     114                        (vvp)->tv_usec -= 1000000;                      \
     115                }                                                       \
     116        } while (0)
     117#endif
     118#ifdef timersub
     119#define timersub(tvp, uvp, vvp)                                         \
     120        do {                                                            \
     121                (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;          \
     122                (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec;       \
     123                if ((vvp)->tv_usec < 0) {                               \
     124                        (vvp)->tv_sec--;                                \
     125                        (vvp)->tv_usec += 1000000;                      \
     126                }                                                       \
     127        } while (0)
     128#endif
     129
     130/*
     131 * Getkerninfo clock information structure
     132 */
     133struct clockinfo {
     134        int     hz;             /* clock frequency */
     135        int     tick;           /* micro-seconds per hz tick */
     136        int     stathz;         /* statistics clock frequency */
     137        int     profhz;         /* profiling clock frequency */
     138};
     139
     140/*
     141 * Names of the interval timers, and structure
     142 * defining a timer setting.
     143 */
     144#define ITIMER_REAL     0
     145#define ITIMER_VIRTUAL  1
     146#define ITIMER_PROF     2
     147#endif /* !TCPV40HDRS */
     148
     149#pragma pack(4)
     150struct  itimerval {
     151        struct  timeval it_interval;    /* timer interval */
     152        struct  timeval it_value;       /* current value */
     153};
     154#pragma pack()
    33155
    34156
    35 int _utimes (__const__ char *, __const__ struct timeval *);
    36 int _gettimeofday (struct timeval *, struct timezone *);
    37 int _settimeofday (__const__ struct timeval *, __const__ struct timezone *);
     157#if defined(TCPV40HDRS) || !defined(_POSIX_SOURCE)
     158int     _System utimes (__const__ char *, __const__ struct timeval *);
     159int     _System gettimeofday (struct timeval *, struct timezone *);
     160int     _System settimeofday (__const__ struct timeval *, __const__ struct timezone *);
     161#ifndef TCPV40HDRS
     162#include <sys/cdefs.h>
     163int     _System adjtime(const struct timeval *, struct timeval *);
     164int     _System getitimer(int, struct itimerval *);
     165int     _System setitimer(int, const struct itimerval *, struct itimerval *);
     166#endif
     167#endif /* TCPV40HDRS */
     168
    38169
    39170#if defined (__cplusplus)
     
    41172#endif
    42173
    43 #endif /* not _SYS_TIME_H */
     174#endif /* not _SYS_TIME_H_ */
Note: See TracChangeset for help on using the changeset viewer.