ObjFW  Diff

Differences From Artifact [618922b043]:

To Artifact [f5a435fe1e]:


227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274

+ (instancetype)distantPast
{
	return [[[self alloc]
	    initWithTimeIntervalSince1970: -62167219200.0] autorelease];
}

- init
{
	struct timeval t;

	self = [super init];

	OF_ENSURE(gettimeofday(&t, NULL) == 0);

	_seconds = t.tv_sec;
	_seconds += (of_time_interval_t)t.tv_usec / 1000000;

	return self;
}

- initWithTimeIntervalSince1970: (of_time_interval_t)seconds
{
	self = [super init];

	_seconds = seconds;

	return self;
}

- initWithTimeIntervalSinceNow: (of_time_interval_t)seconds
{
	self = [self init];

	_seconds += seconds;

	return self;
}

- initWithDateString: (OFString *)string
	      format: (OFString *)format
{
	self = [super init];

	@try {
		const char *UTF8String = [string UTF8String];
		struct tm tm = { 0 };
		int16_t tz = 0;







|













|








|








|
|







227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274

+ (instancetype)distantPast
{
	return [[[self alloc]
	    initWithTimeIntervalSince1970: -62167219200.0] autorelease];
}

- (instancetype)init
{
	struct timeval t;

	self = [super init];

	OF_ENSURE(gettimeofday(&t, NULL) == 0);

	_seconds = t.tv_sec;
	_seconds += (of_time_interval_t)t.tv_usec / 1000000;

	return self;
}

- (instancetype)initWithTimeIntervalSince1970: (of_time_interval_t)seconds
{
	self = [super init];

	_seconds = seconds;

	return self;
}

- (instancetype)initWithTimeIntervalSinceNow: (of_time_interval_t)seconds
{
	self = [self init];

	_seconds += seconds;

	return self;
}

- (instancetype)initWithDateString: (OFString *)string
			    format: (OFString *)format
{
	self = [super init];

	@try {
		const char *UTF8String = [string UTF8String];
		struct tm tm = { 0 };
		int16_t tz = 0;
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
		[self release];
		@throw e;
	}

	return self;
}

- initWithLocalDateString: (OFString *)string
		   format: (OFString *)format
{
	self = [super init];

	@try {
		const char *UTF8String = [string UTF8String];
		struct tm tm = { 0 };
		/*







|
|







284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
		[self release];
		@throw e;
	}

	return self;
}

- (instancetype)initWithLocalDateString: (OFString *)string
				 format: (OFString *)format
{
	self = [super init];

	@try {
		const char *UTF8String = [string UTF8String];
		struct tm tm = { 0 };
		/*
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
		[self release];
		@throw e;
	}

	return self;
}

- initWithSerialization: (OFXMLElement *)element
{
	self = [super init];

	@try {
		void *pool = objc_autoreleasePoolPush();
		union {
			double d;







|







323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
		[self release];
		@throw e;
	}

	return self;
}

- (instancetype)initWithSerialization: (OFXMLElement *)element
{
	self = [super init];

	@try {
		void *pool = objc_autoreleasePoolPush();
		union {
			double d;
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
		OF_HASH_ADD(hash, d.b[i]);

	OF_HASH_FINALIZE(hash);

	return hash;
}

- copy
{
	return [self retain];
}

- (of_comparison_result_t)compare: (id <OFComparing>)object
{
	OFDate *otherDate;







|







385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
		OF_HASH_ADD(hash, d.b[i]);

	OF_HASH_FINALIZE(hash);

	return hash;
}

- (id)copy
{
	return [self retain];
}

- (of_comparison_result_t)compare: (id <OFComparing>)object
{
	OFDate *otherDate;