[OpenAFS-devel] Reset of 'accesses in the past day' on Solaris

Rainer Toebbicke rtb@pclella.cern.ch
Thu, 16 Jun 2005 09:14:21 +0200


This is a multi-part message in MIME format.
--------------030201080705070704040102
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

The "accesses in the past day" counter is reset based on the value of 
"midnight" in the local time zone, which is obtained using the second 
('tz') parameter of gettimeofday().

Alas, Solaris "tolerates" the second parameter but does not support it 
(see "man gettimeofday"), the value returned is whatever is on the stack 
at the time - which in our installation reliably translates to something 
around 8 o'clock in the morning (summertime).

The attached patch corrects this using the official Solaris tzset() 
call. Applicable to both 1.2.x & 1.3.x.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rainer Toebbicke
European Laboratory for Particle Physics(CERN) - Geneva, Switzerland
Phone: +41 22 767 8985       Fax: +41 22 767 7155

--------------030201080705070704040102
Content-Type: text/plain;
 name="patch_timezone"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch_timezone"

*** openafs/src/vol/volume.c.orig	2005-04-11 09:41:56.000000000 +0200
--- openafs/src/vol/volume.c	2005-04-11 10:00:25.000000000 +0200
***************
*** 257,264 ****
--- 257,269 ----
      Lock_Init(&vol_listLock);
      Lock_Init(&FSYNC_handler_lock);
      srandom(time(0));		/* For VGetVolumeInfo */
+ #ifdef AFS_SUN5_ENV
+     tzset();
+     TimeZoneCorrection = daylight ? altzone : timezone;
+ #else
      gettimeofday(&tv, &tz);
      TimeZoneCorrection = tz.tz_minuteswest * 60;
+ #endif /* AFS_SUN5_ENV */
  
      if (volcache > VolumeCacheSize)
  	VolumeCacheSize = volcache;

--------------030201080705070704040102--