Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2. FUNCTION
  3. <<tzset>>---set timezone characteristics from TZ environment variable
  4.  
  5. INDEX
  6.         tzset
  7. INDEX
  8.         _tzset_r
  9.  
  10. ANSI_SYNOPSIS
  11.         #include <time.h>
  12.         void tzset(void);
  13.         void _tzset_r (struct _reent *<[reent_ptr]>);
  14.  
  15. TRAD_SYNOPSIS
  16.         #include <time.h>
  17.         void tzset();
  18.         void _tzset_r (<[reent_ptr]>);
  19.         struct _reent *reent_ptr;
  20.  
  21. DESCRIPTION
  22. <<tzset>> examines the TZ environment variable and sets up the three
  23. external variables: <<_timezone>>, <<_daylight>>, and <<tzname>>.  The
  24. value of <<_timezone>> shall be the offset from the current time zone
  25. to GMT.  The value of <<_daylight>> shall be 0 if there is no daylight
  26. savings time for the current time zone, otherwise it will be non-zero.
  27. The <<tzname>> array has two entries: the first is the name of the
  28. standard time zone, the second is the name of the daylight-savings time
  29. zone.
  30.  
  31. The TZ environment variable is expected to be in the following POSIX
  32. format:
  33.  
  34.   stdoffset1[dst[offset2][,start[/time1],end[/time2]]]
  35.  
  36. where: std is the name of the standard time-zone (minimum 3 chars)
  37.        offset1 is the value to add to local time to arrive at Universal time
  38.          it has the form:  hh[:mm[:ss]]
  39.        dst is the name of the alternate (daylight-savings) time-zone (min 3 chars)
  40.        offset2 is the value to add to local time to arrive at Universal time
  41.          it has the same format as the std offset
  42.        start is the day that the alternate time-zone starts
  43.        time1 is the optional time that the alternate time-zone starts
  44.          (this is in local time and defaults to 02:00:00 if not specified)
  45.        end is the day that the alternate time-zone ends
  46.        time2 is the time that the alternate time-zone ends
  47.          (it is in local time and defaults to 02:00:00 if not specified)
  48.  
  49. Note that there is no white-space padding between fields.  Also note that
  50. if TZ is null, the default is Universal GMT which has no daylight-savings
  51. time.  If TZ is empty, the default EST5EDT is used.
  52.  
  53. The function <<_tzset_r>> is identical to <<tzset>> only it is reentrant
  54. and is used for applications that use multiple threads.
  55.  
  56. RETURNS
  57. There is no return value.
  58.  
  59. PORTABILITY
  60. <<tzset>> is part of the POSIX standard.
  61.  
  62. Supporting OS subroutine required: None
  63. */
  64.  
  65. #include <_ansi.h>
  66. #include <reent.h>
  67. #include <time.h>
  68. #include "local.h"
  69.  
  70. _VOID
  71. _DEFUN_VOID (_tzset_unlocked)
  72. {
  73.   _tzset_unlocked_r (_REENT);
  74. }
  75.  
  76. _VOID
  77. _DEFUN_VOID (tzset)
  78. {
  79.   TZ_LOCK;
  80.   _tzset_unlocked_r (_REENT);
  81.   TZ_UNLOCK;
  82. }
  83.