This is the mail archive of the newlib@sourceware.cygnus.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

newlib's asctime() does not comply with "The Single UNIX Specification, Version 2"


Hi!

Single  UNIX  Specification  V2  says  that  asctime()  must use the
following method to format its output.

sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
            wday_name[timeptr->tm_wday],
            mon_name[timeptr->tm_mon],
            timeptr->tm_mday, timeptr->tm_hour,
            timeptr->tm_min, timeptr->tm_sec,
            1900 + timeptr->tm_year);

whereas current   asctime   from   anoncvs.cygnus.com   uses
"%.3s %.3s %.2d %.2d:%.2d:%.2d %d\n" string.

Easy  to  see,  that  when tm_mday < 10, newlib will pad it with
leading zero. according to standard it must pad it with space.

One  of  the  problems  arising  from  this noncompliance is described
below.

yesterday,  i've checked out (quite large) parts of anoncvs repository
to  my  machine  at work, which is running cygwin. As long as CVS uses
asctime  and friends to fill timestamp field if CVS/Entries file, some
of those entries looked like

/Makefile.in/1.2/Sun Apr 09 06:15:43 2000/-ko/

(note  the  leading  zero  in  timestap). As long as i use cvs at work
there're no problems -- cvs uses the same newlib's asctime to check if
timestamp had been changed. But then i tar.gz'ed my working copy, burn
it  on  cd and take it to my home machine, which is running linux with
glibc-2.1.1.  I've  uncompressed  working  copy  and run "cvs update".
Since  my  home  machine  has rather slow connection to internet, i've
immediately  noticed  too  much  traffic to update yesterday's working
copy.  When  i  turn on cvs's trace mode (cvs -t) i've seen that cvs's
checking   out  all  the  files  again!  Removing  leading  zeroes  in
CVS/Entries solves the problem.

patch's attached below.

Egor.            mailto:deo@logos-m.ru ICQ 5165414 FidoNet 2:5020/496.19

acstime.patch

acstine.Changelog


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]