ObjFW  Diff

Differences From Artifact [879a67dcaa]:

To Artifact [1c6620e225]:


21
22
23
24
25
26
27
28

29
30
31
32
33
34
35
21
22
23
24
25
26
27

28
29
30
31
32
33
34
35







-
+







#include <time.h>

#include <sys/time.h>

#import "OFDate.h"
#import "OFString.h"
#import "OFDictionary.h"
#import "OFNumber.h"
#import "OFXMLElement.h"
#import "OFAutoreleasePool.h"
#ifdef OF_THREADS
# import "OFThread.h"
#endif

#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
287
288
289
290
291
292
293
294

295
296
297
298
299
300
301
302









303
304
305
306
307
308












309
310

311
312
313
314
315
316
317
287
288
289
290
291
292
293

294
295







296
297
298
299
300
301
302
303
304
305





306
307
308
309
310
311
312
313
314
315
316
317
318

319
320
321
322
323
324
325
326







-
+

-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+

-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+

-
+







}

- (OFString*)description
{
	return [self dateStringWithFormat: @"%Y-%m-%dT%H:%M:%SZ"];
}

- (OFString*)stringBySerializing
- (OFXMLElement*)XMLElementBySerializing
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFDictionary *dictionary = [OFDictionary dictionaryWithKeysAndObjects:
	    @"seconds", [OFNumber numberWithInt64: seconds],
	    @"microseconds", [OFNumber numberWithUInt32: microseconds], nil];
	OFString *ret = [[OFString alloc]
	    initWithFormat: @"(class=OFDate,version=0)<%@>",
			    [dictionary stringBySerializing]];
	OFAutoreleasePool *pool;
	OFXMLElement *element;

	element = [OFXMLElement elementWithName: @"object"
				      namespace: OF_SERIALIZATION_NS];

	pool = [[OFAutoreleasePool alloc] init];
	[element addAttributeWithName: @"class"
			  stringValue: [self className]];

	@try {
		[pool release];
	} @finally {
		[ret autorelease];
	}
	[element addChild:
	    [OFXMLElement elementWithName: @"seconds"
				namespace: OF_SERIALIZATION_NS
			      stringValue: [OFString stringWithFormat:
					       @"%" PRId64, seconds]]];
	[element addChild:
	    [OFXMLElement elementWithName: @"microseconds"
				namespace: OF_SERIALIZATION_NS
			      stringValue: [OFString stringWithFormat:
					       @"%" PRIu32, microseconds]]];

	[pool release];

	return ret;
	return element;
}

- (uint32_t)microsecond
{
	return microseconds;
}