home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / TIME / TZSET.C < prev   
Encoding:
C/C++ Source or Header  |  1993-01-02  |  756 b   |  37 lines

  1. /* tzset.c (emx+gcc) -- Copyright (c) 1992-1993 by Kai Uwe Rommel */
  2.  
  3. #define _TZSET_C
  4.  
  5. #include <time.h>
  6. #include <string.h>
  7. #include <stdlib.h>
  8.  
  9. int daylight;
  10. long timezone;
  11. char *tzname[2];
  12.  
  13. int _tzset_flag = 0;
  14.  
  15. void tzset (void)
  16. {
  17.   static char buffer[32];     /* for all threads */
  18.   char *tz, *end;
  19.  
  20.   tz = getenv ("EMXTZ");
  21.   if (tz == NULL)
  22.     tz = getenv ("TZ");
  23.   if (tz == NULL || strlen (tz) >= sizeof (buffer))
  24.     tz = "GMT0";
  25.   strcpy (buffer, tz);
  26.   timezone = strtol (buffer + 3, &end, 10) * 60 * 60;
  27. #if 0
  28.   daylight = ((end != NULL) && (*end != 0) && (strlen (end) >= 3));
  29. #else
  30.   daylight = 0;
  31. #endif
  32.   buffer[3] = 0;
  33.   tzname[0] = buffer;
  34.   tzname[1] = (daylight ? end : "");
  35.   _tzset_flag = 1;
  36. }
  37.