home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / server / sys / time.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-25  |  5.0 KB  |  156 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1992 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon 
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    time.h,v $
  29.  * Revision 2.2  92/05/25  14:46:12  rwd
  30.  *     Move struct tm under else.  From mrt.
  31.  *     [92/05/18            rwd]
  32.  * 
  33.  * Revision 2.1  92/04/21  17:17:01  rwd
  34.  * BSDSS
  35.  * 
  36.  *
  37.  */
  38.  
  39. /*
  40.  * Copyright (c) 1982, 1986 The Regents of the University of California.
  41.  * All rights reserved.
  42.  *
  43.  * Redistribution and use in source and binary forms, with or without
  44.  * modification, are permitted provided that the following conditions
  45.  * are met:
  46.  * 1. Redistributions of source code must retain the above copyright
  47.  *    notice, this list of conditions and the following disclaimer.
  48.  * 2. Redistributions in binary form must reproduce the above copyright
  49.  *    notice, this list of conditions and the following disclaimer in the
  50.  *    documentation and/or other materials provided with the distribution.
  51.  * 3. All advertising materials mentioning features or use of this software
  52.  *    must display the following acknowledgement:
  53.  *    This product includes software developed by the University of
  54.  *    California, Berkeley and its contributors.
  55.  * 4. Neither the name of the University nor the names of its contributors
  56.  *    may be used to endorse or promote products derived from this software
  57.  *    without specific prior written permission.
  58.  *
  59.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  60.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  61.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  62.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  63.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  64.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  65.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  66.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  67.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  68.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  69.  * SUCH DAMAGE.
  70.  *
  71.  *    @(#)time.h    7.6 (Berkeley) 2/22/91
  72.  */
  73.  
  74. #ifndef _SYS_TIME_H_
  75. #define _SYS_TIME_H_
  76.  
  77. /*
  78.  * Structure returned by gettimeofday(2) system call,
  79.  * and used in other calls.
  80.  */
  81. struct timeval {
  82.     long    tv_sec;        /* seconds */
  83.     long    tv_usec;    /* and microseconds */
  84. };
  85.  
  86. struct timezone {
  87.     int    tz_minuteswest;    /* minutes west of Greenwich */
  88.     int    tz_dsttime;    /* type of dst correction */
  89. };
  90. #define    DST_NONE    0    /* not on dst */
  91. #define    DST_USA        1    /* USA style dst */
  92. #define    DST_AUST    2    /* Australian style dst */
  93. #define    DST_WET        3    /* Western European dst */
  94. #define    DST_MET        4    /* Middle European dst */
  95. #define    DST_EET        5    /* Eastern European dst */
  96. #define    DST_CAN        6    /* Canada */
  97.  
  98. /*
  99.  * Operations on timevals.
  100.  *
  101.  * NB: timercmp does not work for >= or <=.
  102.  */
  103. #define    timerisset(tvp)        ((tvp)->tv_sec || (tvp)->tv_usec)
  104. #define    timercmp(tvp, uvp, cmp)    \
  105.     ((tvp)->tv_sec cmp (uvp)->tv_sec || \
  106.      (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
  107. #define    timerclear(tvp)        (tvp)->tv_sec = (tvp)->tv_usec = 0
  108.  
  109. /*
  110.  * Names of the interval timers, and structure
  111.  * defining a timer setting.
  112.  */
  113. #define    ITIMER_REAL    0
  114. #define    ITIMER_VIRTUAL    1
  115. #define    ITIMER_PROF    2
  116.  
  117. struct    itimerval {
  118.     struct    timeval it_interval;    /* timer interval */
  119.     struct    timeval it_value;    /* current value */
  120. };
  121.  
  122. #ifndef KERNEL
  123. #include <time.h>
  124.  
  125. #ifndef _POSIX_SOURCE
  126. #include <sys/cdefs.h>
  127.  
  128. __BEGIN_DECLS
  129. int    adjtime __P((const struct timeval *, struct timeval *));
  130. int    getitimer __P((int, struct itimerval *));
  131. int    gettimeofday __P((struct timeval *, struct timezone *));
  132. int    setitimer __P((int, const struct itimerval *, struct itimerval *));
  133. int    settimeofday __P((const struct timeval *, const struct timezone *));
  134. int    utimes __P((const char *, const struct timeval *));
  135. __END_DECLS
  136. #endif /* !POSIX */
  137.  
  138. #else /* !KERNEL */
  139.  
  140. /*
  141.  * Structure returned by gmtime and localtime calls (see ctime(3)).
  142.  */
  143. struct tm {
  144.     int    tm_sec;
  145.     int    tm_min;
  146.     int    tm_hour;
  147.     int    tm_mday;
  148.     int    tm_mon;
  149.     int    tm_year;
  150.     int    tm_wday;
  151.     int    tm_yday;
  152.     int    tm_isdst;
  153. };
  154. #endif /* !KERNEL */
  155. #endif /* !_SYS_TIME_H_ */
  156.