[netatalk-admins] Funny Dates


Subject: [netatalk-admins] Funny Dates
From: Robert B. Bell (rbell@tv.fu.hac.com)
Date: Tue Feb 02 1999 - 17:21:04 EST


Hello,

I have been having problems with dates on my server.

I am using pre-asun2.1.2-4.tar.gz on a Linux 2.0.35 box.

The dates seems to bounce around by 30 years.
This problem would occur when I would copy a file
from my desktop to the server.

I made the following change to the function ad_refresh()
in libatalk/adouble/ad_open.c

*** libatalk/adouble/ad_open.c.org Tue Feb 2 13:54:50 1999
--- libatalk/adouble/ad_open.c Tue Feb 2 13:55:48 1999
***************
*** 502,508 ****
        
        /* only set dates if the modify dates are way off */
        if (((ad_getdate(ad, AD_DATE_MODIFY | AD_DATE_UNIX, &aint)) == 0) &&
! (aint - st.st_mtime > TIMEWARP_DELTA)) {
          ad_setdate(ad, AD_DATE_MODIFY | AD_DATE_UNIX, st.st_mtime);
          ad_getdate(ad, AD_DATE_CREATE | AD_DATE_UNIX, &aint);
          ad_setdate(ad, AD_DATE_CREATE | AD_DATE_UNIX, aint - AD_DATE_DELTA);
--- 502,510 ----
        
        /* only set dates if the modify dates are way off */
        if (((ad_getdate(ad, AD_DATE_MODIFY | AD_DATE_UNIX, &aint)) == 0) &&
! ((aint > st.st_mtime) /* is modify date after inode's modify
time */
! ? ((aint - st.st_mtime) > TIMEWARP_DELTA) /* yes, subtract unsigns
this way*/
! : ((st.st_mtime - aint) > TIMEWARP_DELTA))) { /* no, subtract the
other way*/
          ad_setdate(ad, AD_DATE_MODIFY | AD_DATE_UNIX, st.st_mtime);
          ad_getdate(ad, AD_DATE_CREATE | AD_DATE_UNIX, &aint);
          ad_setdate(ad, AD_DATE_CREATE | AD_DATE_UNIX, aint - AD_DATE_DELTA);

which makes the date problem of copying the file from desktop to server
go away.

Is this a good change?

Also, I was looking at who calls ad_refresh() from etc/afpd.
I only found it in etc/afpd/fork.c.
And ad_refresh() is called with a ad_getdate(ad, AD_DATE_MODIFY...)
and ad_setdate(ad, AD_DATE_MODIFY...) around it.
The AD_DATE_MODIFY is the "variable" that is being checked to see
if the dates are off by 30 years.
(ad_refresh() is also called by libatalk/cnid/cnid_add.c and cnid_nextid.c.)

Is this right?

Thank you,
  Robert Bell.



This archive was generated by hypermail 2b28 : Sat Dec 18 1999 - 16:16:17 EST