Differences From Artifact [879a67dcaa]:
- File src/OFDate.m — part of check-in [85ffbaabbb] at 2011-05-12 19:58:49 on branch trunk — Style improvements. (user: js, size: 11611) [annotate] [blame] [check-ins using]
To Artifact [1c6620e225]:
- File
src/OFDate.m
— part of check-in
[494dca4ae4]
at
2011-05-14 12:26:39
on branch trunk
— Use XML for serialization.
This way, we don't need a new parser and don't use a new format. (user: js, size: 11847) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
21 22 23 24 25 26 27 | #include <time.h> #include <sys/time.h> #import "OFDate.h" #import "OFString.h" #import "OFDictionary.h" | | | 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 "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 | } - (OFString*)description { return [self dateStringWithFormat: @"%Y-%m-%dT%H:%M:%SZ"]; } | | | | | > > | | | | < | > | > > | > > > > | > | | 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"]; } - (OFXMLElement*)XMLElementBySerializing { OFAutoreleasePool *pool; OFXMLElement *element; element = [OFXMLElement elementWithName: @"object" namespace: OF_SERIALIZATION_NS]; pool = [[OFAutoreleasePool alloc] init]; [element addAttributeWithName: @"class" stringValue: [self className]]; [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 element; } - (uint32_t)microsecond { return microseconds; } |
︙ | ︙ |