[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::decc_bugs

Title:DEC C Problem Reporting Forum
Notice:Report DEC C++ problems in TURRIS::C_PLUS_PLUS
Moderator:CXXC::REPETETCHEON
Created:Fri Nov 13 1992
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1299
Total number of notes:6249

1266.0. ""daylight" symbol broken on DECC V7.x" by AMBER8::MEIER (Quality is the only way to win!) Mon Feb 24 1997 15:47

    We (PATHWORKS) have a lot of code from Unix that uses globals
    "timezone" and "daylight".
    
    We simulate these on V7 by assigning them the values of decc$gl_xxx on
    startup.
    
    However, the value of "daylight" is wrong!
    
    decc$gl_daylight = 1 but the system says
    
    (LNM$SYSTEM_TABLE)
    
      "SYS$LOCALTIME" = "SYS$SYSROOT:[SYS$ZONEINFO.SYSTEM.US]EASTERN."
      "SYS$TIMEZONE_DAYLIGHT_SAVING" = "0"
      "SYS$TIMEZONE_DIFFERENTIAL" = "-18000"
      "SYS$TIMEZONE_NAME" = "EST"
      "SYS$TIMEZONE_RULE" = "EST5EDT4,M4.1.0/2,M10.5.0/2"
    
    so it seems the DEC C value is off. Should be 0...
    
    This causes all the code to compute incorrect times... Can you verify
    this code?
    
    Our workaround is to translate SYS$TIMEZONE_DAYLIGHT_SAVING to get this
    value rather than using decc$gl_daylight.
    
    Here is the info on DECC$SHR (I thought it would be DECC$RTL but that
    doesn't exist?)
    
            Image Identification Information
    
                    image name: "DECC$SHR"
                    image file identification: "X07.1-3"
                    image file build identification: "X6C7-0040069182"
                    link date/time: 25-NOV-1996 21:52:49.56
                    linker identification: "A11-39"
    
            Patch Information
    
                    There are no patches at this time.
    
T.RTitleUserPersonal
Name
DateLines
1266.1see the manualTAVENG::BORISBoris Gubenko, ISEMon Feb 24 1997 17:4025
>     We (PATHWORKS) have a lot of code from Unix that uses globals
>     "timezone" and "daylight".
>     
>     We simulate these on V7 by assigning them the values of decc$gl_xxx on
>     startup.
>     

  Why to simulate? The "timezone" and "daylight" global variables are set
  on both VMS and Unix by the tzset() function.

  On both systems, the daylight variable does not indicate whether the current
  local time is a Daylight Saving Time or not. The meaning of daylight variable
  is as follows:

  (from description of the tzset() function in the DEC C RTL Reference Manual,
  or from tzset man pages):

extern int daylight;

  . daylight is set to 0 if Daylight Savings Time should never be applied to
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
    the time zone. Otherwise, daylight is set to 1.
    ^^^^^^^^^^^^^

  Boris
1266.2exampleTAVENG::BORISBoris Gubenko, ISETue Feb 25 1997 03:1977
  Just to show, how it works.

  Note, that the following variables:

extern long int timezone;
extern int daylight;
extern char *tzname[];

  present a *supported* way to get information about the time zone in use.

  The *current* DST indicator and the name of the *current* time zone (which
  can be either STD or DST zone name) is returned by the localtime() function
  in tm_isdst and tm_zone members of the tm structure passed, respectively.

  Boris

$ say f$getsyi("version")
V7.1    
$ run x

Before tzset():

decc$gl_daylight: 0
daylight: 0
decc$gl_timezone: 0
timezone: 0
tzname[0]: (null) (null)

After tzset():

decc$gl_daylight: 1
daylight: 1
decc$gl_timezone: -7200
timezone: -7200
tzname[0]: IST IDT

tm_ptr->tm_isdst: 0
tm_ptr->tm_zone: IST

X.C
===
#include <stdio.h>
#include <time.h>

extern int  decc$gl_daylight;
extern long int decc$gl_timezone;

extern long int timezone;
extern int daylight;
extern char *tzname[];

main()
{
time_t bintim;
struct tm *tm_ptr;

printf("\nBefore tzset():\n\n");
printf("decc$gl_daylight: %d\n", decc$gl_daylight);
printf("daylight: %d\n", daylight);
printf("decc$gl_timezone: %d\n", decc$gl_timezone);
printf("timezone: %d\n", timezone);
printf("tzname[0]: %s %s\n", tzname[0], tzname[1]);

tzset();

printf("\nAfter tzset():\n\n");
printf("decc$gl_daylight: %d\n", decc$gl_daylight);
printf("daylight: %d\n", daylight);
printf("decc$gl_timezone: %d\n", decc$gl_timezone);
printf("timezone: %d\n", timezone);
printf("tzname[0]: %s %s\n", tzname[0], tzname[1]);

bintim = time(NULL);
tm_ptr = localtime(&bintim);
printf("\ntm_ptr->tm_isdst: %d\n", tm_ptr->tm_isdst);
printf("tm_ptr->tm_zone: %s\n", tm_ptr->tm_zone);
}