[ENH][FIX] DateTimeFactoredPrint-nk -- ( v2: fixed TimeStampTest>>testPrintOn )

ned at squeakland.org ned at squeakland.org
Tue Mar 16 02:27:45 CET 2004


Brent said:
> 1. This changeset fails the TimeStampTest>>testPrintOn SUnit test.

Yes, I missed one. The attached version fixes that one too.

> 2. The leading space in DateAndTimes satisfies the ISO standard. I think this should be a preference.

Lots of formats satisfy the ISO standard, as far as I can tell.

Of course, I'm getting this second-hand, since I'm not about to buy the
standard.
But by the second draft of the standard, the only formats that would
include signs on the years would be the expanded formats, which as far
as I can tell is not what we want or need (I'm looking at (for instance)
section 5.2.1.1 in the second draft):

5.2.1.1 Complete representation When the application identifies the need
for an expression only of a calendar date, then the complete
representation shall be a single numeric data element comprising eight
digits, where [YYYY] represents a calendar year, [MM] the ordinal number
of a calendar month within the calendar year, and [DD] the ordinal
number of a day within the calendar month.

Basic format: YYYYMMDD EXAMPLE 19850412
Extended format: YYYY-MM-DD EXAMPLE 1985-04-12

We could also look at what (for instance) the W3 group recommended.

Or we could look at the C99 (ISO 9899) standard, which has no leading
spaces on the %F format in strftime().

Or at the Unix 'date' command:
$ date --iso-8601=seconds
2004-03-15T17:12:32-0800

Or at the Perl Date::Manip module, which also does not output leading
spaces.

I doubt that the ISO standard specifies what the Squeak API for printOn:
should return, which means that we get to choose.

I added #printOn:withLeadingSpace: and #printYMDOn:withLeadingSpace: to
allow either format. Why bother with a preference when it's not needed?
I figured that anyone who wrote an application that needed to show
negative years could use those.

Do you think there's lots of people who prefer seeing:

	( 2004-03-15T16:48:39+00:00D0:00:00:00)

rather than:

	(2004-03-15T16:48:39+00:00D0:00:00:00)


Anyway, when I tested this, I loaded into a 5816 image the following:

	accurateDateAndTimeNow-avi (archive ID 19971)
	testChronologyHours12-brp.1.cs.gz (archive ID )
	chronologyTimeStampNow-brp (archive ID)
	hour12fix-avi.cs.gz
	
and then my CS.

Upon running all the tests with either 'date' or 'time' in their names,
I still had these failures, which I did not attempt to fix:

TimeTest>>#testHour
TimespanDoSpanAYearTest>>#testWeeksDo
TimeTest>>#testClassComment
TimeStampTest>>#testClassComment
TimespanTest>>#testCurrent
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DateTimeFactoredPrint-nk.cs.gz
Type: application/octet-stream
Size: 2030 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-harvest/attachments/20040315/466e953f/DateTimeFactoredPrint-nk.cs.obj


More information about the Squeak-harvest mailing list