Strftime's %C and %y formats versus wide-ranging tm_yea

WHarms at bfs.de WHarms at bfs.de
Sat Oct 16 09:20:59 UTC 2004


hi paul
IMHO this will fail in case of error.

1. snprint() old version return -1 on error
therefor reducing result by one 

2. snprint() new version return size that is *needed*
any overflow will cause pt point to exacly were i should not be

is a private version of snprintf/strftime an option ?

regards,
walter

- - - - - - - - - - - - - - Original Message - - - - - - - - - - - - - -
From: Paul Eggert <eggert at CS.UCLA.EDU>
Subject: Re: Strftime's %C and %y formats versus wide-ranging tm_year va
Date: 10/15/04 21:03

"Olson, Arthur David (NIH/NCI)" <olsona at dc37a.nci.nih.gov> writes:

  	** We avoid using snprintf since it's not available on all systems.
  	*/
! 	pt = result + sprintf(result,
! 		ASCTIME_FMT,
  		wn, mn,
  		timeptr->tm_mday, timeptr->tm_hour,
! 		timeptr->tm_min, timeptr->tm_sec);
! 	if (-999 - TM_YEAR_BASE <= timeptr->tm_year
! 	    && timeptr->tm_year <= 9999 - TM_YEAR_BASE)
! 		pt += sprintf(pt,
! 			SMALL_YEAR_FMT, timeptr->tm_year + TM_YEAR_BASE);
! 	else
! 		/*



More information about the tz mailing list