home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / bsd / sys / time.h < prev    next >
Text File  |  1993-10-19  |  3KB  |  119 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1989 Carnegie-Mellon University
  4.  * Copyright (c) 1988 Carnegie-Mellon University
  5.  * Copyright (c) 1987 Carnegie-Mellon University
  6.  * All rights reserved.  The CMU software License Agreement specifies
  7.  * the terms and conditions for use and redistribution.
  8.  */
  9. /*
  10.  * HISTORY
  11.  * $Log:    time.h,v $
  12.  * Revision 2.4  89/03/09  22:08:32  rpd
  13.  *     More cleanup.
  14.  * 
  15.  * Revision 2.3  89/02/25  17:57:02  gm0w
  16.  *     Made all code dependent on CMUCS always true.
  17.  *     [89/02/14            mrt]
  18.  * 
  19.  * Revision 2.2  88/08/24  02:48:22  mwyoung
  20.  *     Adjusted include file references.
  21.  *     [88/08/17  02:25:13  mwyoung]
  22.  *
  23.  * 06-Jan-88  Jay Kistler (jjk) at Carnegie Mellon University
  24.  *    Added declarations for __STDC__.
  25.  *
  26.  * 20-Jul-86  Michael Young (mwyoung) at Carnegie-Mellon University
  27.  *    Added _TIME_ definition check to prevent multiple inclusion.
  28.  *
  29.  * 27-Jan-86  Avadis Tevanian (avie) at Carnegie-Mellon University
  30.  *    Restored the "struct tm" definition, we need it in kern_clock.
  31.  *
  32.  */
  33. /*
  34.  * Copyright (c) 1982, 1986 Regents of the University of California.
  35.  * All rights reserved.  The Berkeley software License Agreement
  36.  * specifies the terms and conditions for redistribution.
  37.  *
  38.  *    @(#)time.h    7.1 (Berkeley) 6/4/86
  39.  */
  40.  
  41. #ifndef    _SYS_TIME_H_
  42. #define _SYS_TIME_H_
  43.  
  44. /*
  45.  * Structure returned by gettimeofday(2) system call,
  46.  * and used in other calls.
  47.  */
  48. struct timeval {
  49.     long    tv_sec;        /* seconds */
  50.     long    tv_usec;    /* and microseconds */
  51. };
  52.  
  53. struct timezone {
  54.     int    tz_minuteswest;    /* minutes west of Greenwich */
  55.     int    tz_dsttime;    /* type of dst correction */
  56. };
  57.  
  58. #define DST_NONE    0    /* not on dst */
  59. #define DST_USA        1    /* USA style dst */
  60. #define DST_AUST    2    /* Australian style dst */
  61. #define DST_WET        3    /* Western European dst */
  62. #define DST_MET        4    /* Middle European dst */
  63. #define DST_EET        5    /* Eastern European dst */
  64. #define DST_CAN        6    /* Canada */
  65.  
  66. /*
  67.  * Operations on timevals.
  68.  *
  69.  * NB: timercmp does not work for >= or <=.
  70.  */
  71. #define timerisset(tvp)        ((tvp)->tv_sec || (tvp)->tv_usec)
  72. #define timercmp(tvp, uvp, cmp)    \
  73.     ((tvp)->tv_sec cmp (uvp)->tv_sec || \
  74.      ((tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec))
  75. #define timerclear(tvp)        (tvp)->tv_sec = (tvp)->tv_usec = 0
  76.  
  77. /*
  78.  * Names of the interval timers, and structure
  79.  * defining a timer setting.
  80.  */
  81. #define ITIMER_REAL    0
  82. #define ITIMER_VIRTUAL    1
  83. #define ITIMER_PROF    2
  84.  
  85. struct    itimerval {
  86.     struct    timeval it_interval;    /* timer interval */
  87.     struct    timeval it_value;    /* current value */
  88. };
  89.  
  90. #ifdef    KERNEL
  91. /*
  92.  * Structure returned by gmtime and localtime calls (see ctime(3)).
  93.  */
  94. struct tm {
  95.     int    tm_sec;
  96.     int    tm_min;
  97.     int    tm_hour;
  98.     int    tm_mday;
  99.     int    tm_mon;
  100.     int    tm_year;
  101.     int    tm_wday;
  102.     int    tm_yday;
  103.     int    tm_isdst;
  104. };
  105. #else    KERNEL
  106. #import <time.h>
  107. #endif    KERNEL
  108.  
  109. #if    defined(__STDC__) && !defined(KERNEL)
  110. extern int adjtime(struct timeval *, struct timeval *);
  111. extern int getitimer(int, struct itimerval *);
  112. extern int setitimer(int, struct itimerval *, struct itimerval *);
  113. extern int gettimeofday(struct timeval *, struct timezone *);
  114. extern int settimeofday(struct timeval *, struct timezone *);
  115. extern int utimes(const char *, struct timeval *);
  116. #endif    defined(__STDC__) && !defined(KERNEL)
  117.  
  118. #endif    _SYS_TIME_H_
  119.