resnick@cogsci.uiuc.edu (Pete Resnick) (04/19/91)
Well, I sent this off to MacDTS as a bug report, but got back a hack
fix for the problem and the standard disclaimer "We don't do code-
level support for non-Partner types." So here goes to the net:
I have found what appears to be a possible bug in the IUDatePString
routine in the International Utilities Package. I wished to get the
date in long format containing only the numeric day of the month and
the month, leaving out the year and the day of the week. So I made the
following calls (in C):
main ()
{
Str255 tempString;
DateTimeRec tempTimeRec = {1904, 1, 1, 0, 0, 0, 1};
unsigned long tempSecs;
Intl1Hndl intlRsrc;
Byte tempByte;
intlRsrc = (Intl1Hndl)IUGetIntl(1);
tempByte = (**intlRsrc).suppressDay;
(**intlRsrc).suppressDay = supWeek + supYear;
Date2Secs(&tempTimeRec, &tempSecs);
IUDatePString(tempSecs, longDate, &tempString, intlRsrc);
(**intlRsrc).suppressDay = tempByte;
}
Unfortunately, tempString is "January 1," instead of just "January 1".
This also happens if I use the new Script Manager calls. Now, the
response I got, from someone who signed "sk", was to check if there was
a comma in the last byte and chop it off if there is. Bad answer.
First, I know that in some country, the separater won't be a comma, but
some other character. And sure as shootin', if I go looking for
separaters in the last byte, some country is going to have that as part
of the way they format a month and date.
What I would like to know is how to tell when IUDatePString is doing
something silly. I would like to know the algorithm by which that last
separater is put it so that I can work back from the intl. resource and
figure out if I *really* should chop off the last byte. Can anybody out
help?
Thanks,
pr
--
Pete Resnick (...so what is a mojo, and why would one be rising?)
Graduate assistant - Philosophy Department, Gregory Hall, UIUC
System manager - Cognitive Science Group, Beckman Institute, UIUC
Internet/ARPAnet/EDUnet : resnick@cogsci.uiuc.edu
BITNET (if no other way) : FREE0285@UIUCVMD