ObjFW  Diff

Differences From Artifact [d1491b40fa]:

To Artifact [08b8759c25]:


341
342
343
344
345
346
347

348
349
350
351
352
353
354
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355







+







- (uint16_t)localDayOfYear
{
	LOCALTIME_RET(tm_yday + 1)
}

- (OFString*)dateStringWithFormat: (OFString*)fmt
{
	OFString *ret;
	time_t sec_ = sec;
	struct tm tm;
	char *buf;

	if (sec != sec_)
		@throw [OFOutOfRangeException newWithClass: isa];

376
377
378
379
380
381
382
383

384
385
386


387
388
389
390

391
392
393
394
395
396
397
377
378
379
380
381
382
383

384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401







-
+



+
+




+








	buf = [self allocMemoryWithSize: of_pagesize];

	@try {
		if (!strftime(buf, of_pagesize, [fmt cString], &tm))
			@throw [OFOutOfRangeException newWithClass: isa];

		return [OFString stringWithCString: buf];
		ret = [OFString stringWithCString: buf];
	} @finally {
		[self freeMemory: buf];
	}

	return ret;
}

- (OFString*)localDateStringWithFormat: (OFString*)fmt
{
	OFString *ret;
	time_t sec_ = sec;
	struct tm tm;
	char *buf;

	if (sec != sec_)
		@throw [OFOutOfRangeException newWithClass: isa];

419
420
421
422
423
424
425
426

427
428
429


430
431
432
433
434
435
436
423
424
425
426
427
428
429

430
431
432
433
434
435
436
437
438
439
440
441
442







-
+



+
+








	buf = [self allocMemoryWithSize: of_pagesize];

	@try {
		if (!strftime(buf, of_pagesize, [fmt cString], &tm))
			@throw [OFOutOfRangeException newWithClass: isa];

		return [OFString stringWithCString: buf];
		ret = [OFString stringWithCString: buf];
	} @finally {
		[self freeMemory: buf];
	}

	return ret;
}

- (OFDate*)earlierDate: (OFDate*)date
{
	if ([self compare: date] == OF_ORDERED_DESCENDING)
		return [[date retain] autorelease];