Show
Ignore:
Timestamp:
04/16/06 21:46:31 (3 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib-src/b2m.c

    r3684 r4058  
    4545typedef int logical; 
    4646 
     47#define TM_YEAR_BASE 1900 
     48 
     49/* Nonzero if TM_YEAR is a struct tm's tm_year value that causes 
     50   asctime to have well-defined behavior.  */ 
     51#ifndef TM_YEAR_IN_ASCTIME_RANGE 
     52# define TM_YEAR_IN_ASCTIME_RANGE(tm_year) \ 
     53    (1000 - TM_YEAR_BASE <= (tm_year) && (tm_year) <= 9999 - TM_YEAR_BASE) 
     54#endif 
     55 
    4756/* 
    4857 * A `struct linebuffer' is a structure which holds a line of text. 
     
    8897  logical labels_saved, printing, header; 
    8998  time_t ltoday; 
     99  struct tm *tm; 
    90100  char *labels, *p, *today; 
    91101  struct linebuffer data; 
     
    132142  labels_saved = printing = header = FALSE; 
    133143  ltoday = time (0); 
    134   today = ctime (&ltoday); 
     144  /* Convert to a string, checking for out-of-range time stamps. 
     145     Don't use 'ctime', as that might dump core if the hardware clock 
     146     is set to a bizarre value.  */ 
     147  tm = localtime (&ltoday); 
     148  if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) 
     149         && (today = asctime (tm)))) 
     150    fatal ("current time is out of range"); 
    135151  data.size = 200; 
    136152  data.buffer = xnew (200, char);