ObjFW  Check-in [65111e7409]

Overview
Comment:Don't include microseconds in -[OFDate description].
This way, it conforms to ISO 8601.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 65111e74092a481b396af975557797d0c5cef642197c3f9cde87bee85a2296a9
User & Date: js on 2011-01-01 14:20:47
Other Links: manifest | tags
Context
2011-01-01
14:58
Add +[distantFuture] and +[distantPast] to OFDate. check-in: c57f9fe4fb user: js tags: trunk
14:20
Don't include microseconds in -[OFDate description].
This way, it conforms to ISO 8601.
check-in: 65111e7409 user: js tags: trunk
2010-12-31
00:30
Add -[earlierDate:] and -[laterDate:] to OFDate. check-in: bb9a6fb0da user: js tags: trunk
Changes

Modified src/OFDate.m from [4a813140c4] to [4afab9eb58].

178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
		return OF_ORDERED_DESCENDING;

	return OF_ORDERED_SAME;
}

- (OFString*)description
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFString *tmp, *ret;

	tmp = [self dateStringWithFormat: @"%Y-%m-%dT%H:%M:%S"];

	if (usec == 0)
		ret = [OFString stringWithFormat: @"%sZ", [tmp cString]];
	else
		ret = [OFString stringWithFormat: @"%s.%06dZ", [tmp cString],
						  usec];

	[ret retain];
	[pool release];

	return [ret autorelease];
}

- (suseconds_t)microsecond
{
	return usec;
}








<
<
<
|
<
<
<
<
<
<
<
<
<
<
<







178
179
180
181
182
183
184



185











186
187
188
189
190
191
192
		return OF_ORDERED_DESCENDING;

	return OF_ORDERED_SAME;
}

- (OFString*)description
{



	return [self dateStringWithFormat: @"%Y-%m-%dT%H:%M:%SZ"];











}

- (suseconds_t)microsecond
{
	return usec;
}

Modified tests/OFDateTests.m from [f6f7311378] to [b25e0ea5a8].

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

	TEST(@"+[dateWithTimeIntervalSince1970:microseconds:",
	    (d2 = [OFDate dateWithTimeIntervalSince1970: 3600 * 25 + 5
					   microseconds: 1]))

	TEST(@"-[description]",
	    [[d1 description] isEqual: @"1970-01-01T00:00:00Z"] &&
	    [[d2 description] isEqual: @"1970-01-02T01:00:05.000001Z"])

	TEST(@"-[isEqual:]",
	    [d1 isEqual: [OFDate dateWithTimeIntervalSince1970: 0]] &&
	    ![d1 isEqual: [OFDate dateWithTimeIntervalSince1970: 0
						   microseconds: 1]])

	TEST(@"-[compare:]", [d1 compare: d2] == OF_ORDERED_ASCENDING)







|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

	TEST(@"+[dateWithTimeIntervalSince1970:microseconds:",
	    (d2 = [OFDate dateWithTimeIntervalSince1970: 3600 * 25 + 5
					   microseconds: 1]))

	TEST(@"-[description]",
	    [[d1 description] isEqual: @"1970-01-01T00:00:00Z"] &&
	    [[d2 description] isEqual: @"1970-01-02T01:00:05Z"])

	TEST(@"-[isEqual:]",
	    [d1 isEqual: [OFDate dateWithTimeIntervalSince1970: 0]] &&
	    ![d1 isEqual: [OFDate dateWithTimeIntervalSince1970: 0
						   microseconds: 1]])

	TEST(@"-[compare:]", [d1 compare: d2] == OF_ORDERED_ASCENDING)