[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Another daylight savings time fix

From: John Fowler
Subject: Another daylight savings time fix
Date: Mon, 29 Oct 2001 08:13:47 -0700 (MST)

I am using GNU Make version 3.79.1.

The last fix I sent in was when daylight savings time started.  It was
a fix for VMS to arscan.c in the VMS_get_member_info() function, as follows:

#ifdef __DECC
  val = decc$fix_time (&mhd->mhd$l_datim) + timezone - daylight*3600;

I added the "daylight" variable to this line.  Unfortunately, I hadn't
realized that the daylight variable always has the value 1 if your time zone
ever goes to daylight savings time, whether or not you are currently in it.
So now it's not working again.  Grrrrr.

I've made another fix that will hopefully work whether or not we are in
daylight savings time.  Here is the new function in its entirety:

static int
VMS_get_member_info (module, rfa)
     struct dsc$descriptor_s *module;
     unsigned long *rfa;
  int status, i;
  long int fnval;
  time_t val;
  static struct dsc$descriptor_s bufdesc =
  struct mhddef *mhd;
  char filename[128];
#ifdef __DECC
  int isdst;
  bufdesc.dsc$a_pointer = filename;
  bufdesc.dsc$w_length = sizeof (filename);
  status = lbr$set_module (&VMS_lib_idx, rfa, &bufdesc,
                           &bufdesc.dsc$w_length, 0);
  if (! (status & 1))
      error (NILF, _("lbr$set_module failed to extract module info, status = %d^
      lbr$close (&VMS_lib_idx);
      return 0;
  mhd = (struct mhddef *) filename;
#ifdef __DECC
  val = time(NULL);
  if (localtime(&val)->tm_isdst > 0)
    isdst = 1;
    isdst = 0;
  val = decc$fix_time (&mhd->mhd$l_datim) + timezone - isdst*3600;
  for (i = 0; i < module->dsc$w_length; i++)
    filename[i] = _tolower ((unsigned char)module->dsc$a_pointer[i]);
  filename[i] = '\0';
  VMS_member_date = (time_t) -1;
  fnval =
    (*VMS_function) (-1, filename, 0, 0, 0, 0, val, 0, 0, 0,
  if (fnval)
      VMS_member_date = fnval;
      return 0;
    return 1;

The changes are the isdst variable declared near the top, and the new
code inside the #ifdef __DECC block.

I'll let you know in April if this still doesn't work....

John Fowler

reply via email to

[Prev in Thread] Current Thread [Next in Thread]