home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip540.zip / amiga / z-time.h < prev   
C/C++ Source or Header  |  1998-04-25  |  2KB  |  69 lines

  1. #ifndef __amiga_z_time_h
  2. #define __amiga_z_time_h
  3.  
  4. /* A <time.h> replacement for use with time_lib.c */
  5. /* Usage: * Define (or Undefine) USE_TIME_LIB below             */
  6. /*        * Replace any <time.h> includes by "amiga/z-time.h"   */
  7.  
  8. /* First of all: Select whether to use time_lib functions or not */
  9. #if 1
  10. #  ifndef USE_TIME_LIB
  11. #  define USE_TIME_LIB
  12. #  endif
  13. #else
  14. #  ifdef USE_TIME_LIB
  15. #  undef USE_TIME_LIB
  16. #  endif
  17. #endif
  18.  
  19. #ifdef USE_TIME_LIB
  20.    /* constants needed everywhere */
  21. #  define MAXTIMEZONELEN 16
  22. #  ifndef DEFAULT_TZ_STR
  23. #    define DEFAULT_TZ_STR "EST5EDT" /* US East Coast is the usual default */
  24. #  endif
  25.  
  26.    /* define time_t where needed (everywhere but amiga/time_lib.c) */
  27. #  if defined(__SASC) && defined(NO_TIME_H) && !defined(__amiga_time_lib_c)
  28.      typedef unsigned long time_t;  /* override sas/c's time_t */
  29. #    define _TIME_T        1        /* mark it as already defined */
  30. #    define _COMMTIME_H             /* do not include sys/commtime.h */
  31. #  endif
  32.  
  33. #  ifndef NO_TIME_H
  34. #    include <time.h>               /* time_lib.c uses NO_TIME_H */
  35. #  endif
  36.  
  37.    /* adjust included time.h */
  38. #  ifdef __SASC
  39.      /* tz[sd]tn arrays have different length now: need different names */
  40. #    define __tzstn         tzstn
  41. #    define __tzdtn         tzdtn
  42.      /* prevent other possible name conflicts */
  43. #    define __nextdstchange nextdstchange
  44. #    define __stdoffset     stdoffset
  45. #    define __dstoffset     dstoffset
  46.  
  47. #    ifndef __amiga_time_lib_c
  48. #      ifdef TZ
  49. #        undef TZ                       /* defined in sas/c time.h */
  50. #      endif TZ
  51. #      define TZ  DEFAULT_TZ_STR        /* redefine TZ to default timezone */
  52.        extern char __tzstn[MAXTIMEZONELEN];
  53.        extern char __tzdtn[MAXTIMEZONELEN];
  54. #    endif
  55. #  endif /* __SASC */
  56.  
  57. #  ifdef AZTEC_C
  58.      void tzset(void);
  59. #  endif
  60.  
  61. #else /* ?USE_TIME_LIB */
  62.  
  63. #  ifndef NO_TIME_H
  64. #    include <time.h>
  65. #  endif
  66. #endif /* !USE_TIME_LIB */
  67.  
  68. #endif /* __amiga_z_time_h */
  69.