home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OS9000 / APPS / rcs.lzh / rcs1 / time.h < prev    next >
Text File  |  1996-04-20  |  3KB  |  116 lines

  1. /* Structure for use by time manipulating subroutines.
  2.  * The following library routines use it:
  3.  *    libc: ctime, localtime, gmtime, asctime
  4.  *    libcx: partime, maketime (may not be installed yet)
  5.  */
  6.  
  7. #define TIMEID "$Id: time.h_v 1.2 96/04/07 00:32:17 hiro Exp $"
  8.  
  9. /* $Log:    time.h_v $
  10.  * Revision 1.2  96/04/07  00:32:17  hiro
  11.  * Ported to OS-9000.
  12.  * 
  13.  * Revision 1.1  93/04/02  01:39:09  hiro
  14.  * Initial revision
  15.  * 
  16.  * Revision 1.1  90/07/19  15:23:06  momo
  17.  * Initial revision
  18.  * 
  19.  * Revision 1.1  84/01/23  14:50:50  kcs
  20.  * Initial revision
  21.  * 
  22.  * Revision 1.1  82/05/06  11:34:29  wft
  23.  * Initial revision
  24.  * 
  25.  */
  26.  
  27. #ifdef _OS9000
  28. #include <time.h>
  29. #define LCLZONE (5*60)    /* Until V7 ftime(2) works, this defines local zone*/
  30. #define TMNULL (-1)    /* Items not specified are given this value
  31.              * in order to distinguish null specs from zero
  32.              * specs.  This is only used by partime and
  33.              * maketime. */
  34.  
  35.     /* Indices into TM structure */
  36. #define TM_SEC 0    /* 0-59            */
  37. #define TM_MIN 1    /* 0-59            */
  38. #define TM_HOUR 2    /* 0-23            */
  39. #define TM_MDAY 3    /* 1-31            day of month */
  40. #define TM_DAY TM_MDAY    /*  "            synonym      */
  41. #define TM_MON 4    /* 0-11            */
  42. #define TM_YEAR 5    /* (year-1900) (year)    */
  43. #define TM_WDAY 6    /* 0-6            day of week (0 = Sunday) */
  44. #define TM_YDAY 7    /* 0-365        day of year */
  45. #define TM_ISDST 8    /* 0 Std, 1 DST        */
  46.     /* New stuff */
  47. #    define TM_ZON 9    /* 0-(24*60) minutes west of Greenwich */
  48. #    define TM_AMPM 10    /* 1 AM, 2 PM        */
  49.  
  50. #else
  51.  
  52. struct tm {     /* See defines below for allowable ranges */
  53.     int tm_sec;
  54.     int tm_min;
  55.     int tm_hour;
  56.     int tm_mday;
  57.     int tm_mon;
  58.     int tm_year;
  59.     int tm_wday;
  60.     int tm_yday;
  61.     int tm_isdst;
  62.     int tm_zon;    /* NEW: mins westward of Greenwich */
  63.     int tm_ampm;    /* NEW: 1 if AM, 2 if PM */
  64. };
  65.  
  66. #define LCLZONE (5*60)    /* Until V7 ftime(2) works, this defines local zone*/
  67. #define TMNULL (-1)    /* Items not specified are given this value
  68.              * in order to distinguish null specs from zero
  69.              * specs.  This is only used by partime and
  70.              * maketime. */
  71.  
  72.     /* Indices into TM structure */
  73. #define TM_SEC 0    /* 0-59            */
  74. #define TM_MIN 1    /* 0-59            */
  75. #define TM_HOUR 2    /* 0-23            */
  76. #define TM_MDAY 3    /* 1-31            day of month */
  77. #define TM_DAY TM_MDAY    /*  "            synonym      */
  78. #define TM_MON 4    /* 0-11            */
  79. #define TM_YEAR 5    /* (year-1900) (year)    */
  80. #define TM_WDAY 6    /* 0-6            day of week (0 = Sunday) */
  81. #define TM_YDAY 7    /* 0-365        day of year */
  82. #define TM_ISDST 8    /* 0 Std, 1 DST        */
  83.     /* New stuff */
  84. #    define TM_ZON 9    /* 0-(24*60) minutes west of Greenwich */
  85. #    define TM_AMPM 10    /* 1 AM, 2 PM        */
  86.  
  87. #ifdef OSK
  88.  
  89. #ifndef ctime
  90. #ifndef D_TckSec
  91. #include <setsys.h>
  92. #endif
  93.  
  94. typedef long    clock_t;
  95. typedef long    time_t;
  96.  
  97. /* X3J11 Draft says *nowhere* that CLK_TCK is a constant! */
  98.  
  99. #define CLK_TCK    ((clock_t) _getsys(D_TckSec, 2))
  100.  
  101. clock_t        clock();
  102. time_t        time(), mktime();
  103. double        difftime();
  104. char        *asctime();
  105. struct tm    *gmtime();
  106. struct tm    *localtime();
  107. extern        togmtime();
  108.  
  109. #define    ctime(t)            asctime(localtime((t)))
  110. #define difftime(t1, t0)    ((double) ((t1) - (t0)))
  111.  
  112. #endif
  113.  
  114. #endif /* OSK */
  115. #endif /* _OS9000 */
  116.