This is the mail archive of the
newlib@sourceware.cygnus.com
mailing list for the newlib project.
newlib's asctime() does not comply with "The Single UNIX Specification, Version 2"
- To: <newlib at sourceware dot cygnus dot com>
- Subject: newlib's asctime() does not comply with "The Single UNIX Specification, Version 2"
- From: Egor Duda <deo at logos-m dot ru>
- Date: Wed, 10 May 2000 19:55:24 +0400
- Organization: DEO
- Reply-To: Egor Duda <deo at logos-m dot ru>
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