ULL seems to mean something different on my alpha (using the native
compiler) than on DJB's system.  This isn't too surprising, since ULL
isn't mentioned in Harbison&Steele, and I'm guessing it's not in ANSI.

I guess it could be a compiler bug, too.

include <stdio.h>

main() {
        unsigned long x;
        x = 987654321UL;
        printf ("UL: x=%d\n",x);
        x = 987654321ULL;
        printf ("ULL: x=%d\n",x);
}

yields...

UL: x=987654321
ULL: x=87654321

This was causing funny dates (11 Feb 1963626756636 00:52:22 -0000) from mess822
till I applied the following changes...


diff -c -r dist/mess822-0.58/caltime_tai.c local/mess822-0.58/caltime_tai.c
*** dist/mess822-0.58/caltime_tai.c     Fri Sep 04 19:33:37 1998
--- local/mess822-0.58/caltime_tai.c    Mon Jul 05 11:48:11 1999
***************
*** 19,25 ****
    s = ct->hour * 60 + ct->minute;
    s = (s - ct->offset) * 60 + ct->second;
  
!   t->x = day * 86400ULL + 4611686014920671114ULL + (long long) s;
  
    leapsecs_add(t,ct->second == 60);
  }
--- 19,25 ----
    s = ct->hour * 60 + ct->minute;
    s = (s - ct->offset) * 60 + ct->second;
  
!   t->x = day * 86400UL + 4611686014920671114UL + (long) s;
  
    leapsecs_add(t,ct->second == 60);
  }
diff -c -r dist/mess822-0.58/caltime_utc.c local/mess822-0.58/caltime_utc.c
*** dist/mess822-0.58/caltime_utc.c     Fri Sep 04 19:33:37 1998
--- local/mess822-0.58/caltime_utc.c    Mon Jul 05 11:48:22 1999
***************
*** 22,35 ****
    u = t2.x;
  
    u += 58486;
!   s = u % 86400ULL;
  
    ct->second = (s % 60) + leap; s /= 60;
    ct->minute = s % 60; s /= 60;
    ct->hour = s;
  
!   u /= 86400ULL;
!   caldate_frommjd(&ct->date,/*XXX*/(long) (u - 53375995543064ULL),pwday,pyday);
  
    ct->offset = 0;
  }
--- 22,35 ----
    u = t2.x;
  
    u += 58486;
!   s = u % 86400UL;
  
    ct->second = (s % 60) + leap; s /= 60;
    ct->minute = s % 60; s /= 60;
    ct->hour = s;
  
!   u /= 86400UL;
!   caldate_frommjd(&ct->date,/*XXX*/(long) (u - 53375995543064UL),pwday,pyday);
  
    ct->offset = 0;
  }
diff -c -r dist/mess822-0.58/tai_now.c local/mess822-0.58/tai_now.c
*** dist/mess822-0.58/tai_now.c Fri Sep 04 19:33:37 1998
--- local/mess822-0.58/tai_now.c        Mon Jul 05 11:48:33 1999
***************
*** 4,8 ****
  void tai_now(t)
  struct tai *t;
  {
!   t->x = 4611686018427387914ULL + (uint64) time((long *) 0);
  }
--- 4,8 ----
  void tai_now(t)
  struct tai *t;
  {
!   t->x = 4611686018427387914UL + (uint64) time((long *) 0);
  }

-- 
Aaron Nabil

Reply via email to