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/fakemail.c

    r4037 r4058  
    7070#define true 1 
    7171#define false 0 
     72 
     73#define TM_YEAR_BASE 1900 
     74 
     75/* Nonzero if TM_YEAR is a struct tm's tm_year value that causes 
     76   asctime to have well-defined behavior.  */ 
     77#ifndef TM_YEAR_IN_ASCTIME_RANGE 
     78# define TM_YEAR_IN_ASCTIME_RANGE(tm_year) \ 
     79    (1000 - TM_YEAR_BASE <= (tm_year) && (tm_year) <= 9999 - TM_YEAR_BASE) 
     80#endif 
    7281 
    7382/* Various lists */ 
     
    355364  char *the_string, *temp; 
    356365  long idiotic_interface; 
     366  struct tm *tm; 
    357367  long prefix_length; 
    358368  long user_length; 
     
    362372  prefix_length = strlen (FROM_PREFIX); 
    363373  time (&idiotic_interface); 
    364   the_date = ctime (&idiotic_interface); 
     374  /* Convert to a string, checking for out-of-range time stamps. 
     375     Don't use 'ctime', as that might dump core if the hardware clock 
     376     is set to a bizarre value.  */ 
     377  tm = localtime (&idiotic_interface); 
     378  if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) 
     379         && (the_date = asctime (tm)))) 
     380    fatal ("current time is out of range", 0); 
    365381  /* the_date has an unwanted newline at the end */ 
    366382  date_length = strlen (the_date) - 1;