︙ | | |
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
-
+
-
+
-
+
|
seconds += microseconds / 1000000;
microseconds %= 1000000;
return self;
}
- (BOOL)isEqual: (id)obj
- (BOOL)isEqual: (id)object
{
OFDate *otherDate;
if (![obj isKindOfClass: [OFDate class]])
if (![object isKindOfClass: [OFDate class]])
return NO;
otherDate = (OFDate*)obj;
otherDate = (OFDate*)object;
if (otherDate->seconds != seconds ||
otherDate->microseconds != microseconds)
return NO;
return YES;
}
|
︙ | | |
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
|
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
|
-
+
-
+
|
}
- (uint16_t)localDayOfYear
{
LOCALTIME_RET(tm_yday + 1)
}
- (OFString*)dateStringWithFormat: (OFString*)fmt
- (OFString*)dateStringWithFormat: (OFString*)format
{
OFString *ret;
time_t seconds_ = (time_t)seconds;
struct tm tm;
char *buf;
char *buffer;
if (seconds != seconds_)
@throw [OFOutOfRangeException newWithClass: isa];
#ifdef HAVE_GMTIME_R
if (gmtime_r(&seconds_, &tm) == NULL)
@throw [OFOutOfRangeException newWithClass: isa];
|
︙ | | |
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
|
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
|
-
+
-
+
-
+
-
+
-
+
-
+
|
# ifdef OF_THREADS
} @finally {
[mutex unlock];
}
# endif
#endif
buf = [self allocMemoryWithSize: of_pagesize];
buffer = [self allocMemoryWithSize: of_pagesize];
@try {
if (!strftime(buf, of_pagesize, [fmt cString], &tm))
if (!strftime(buffer, of_pagesize, [format cString], &tm))
@throw [OFOutOfRangeException newWithClass: isa];
ret = [OFString stringWithCString: buf];
ret = [OFString stringWithCString: buffer];
} @finally {
[self freeMemory: buf];
[self freeMemory: buffer];
}
return ret;
}
- (OFString*)localDateStringWithFormat: (OFString*)fmt
- (OFString*)localDateStringWithFormat: (OFString*)format
{
OFString *ret;
time_t seconds_ = (time_t)seconds;
struct tm tm;
char *buf;
char *buffer;
if (seconds != seconds_)
@throw [OFOutOfRangeException newWithClass: isa];
#ifdef HAVE_LOCALTIME_R
if (localtime_r(&seconds_, &tm) == NULL)
@throw [OFOutOfRangeException newWithClass: isa];
|
︙ | | |
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
|
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
|
-
+
-
+
-
+
-
+
|
# ifdef OF_THREADS
} @finally {
[mutex unlock];
}
# endif
#endif
buf = [self allocMemoryWithSize: of_pagesize];
buffer = [self allocMemoryWithSize: of_pagesize];
@try {
if (!strftime(buf, of_pagesize, [fmt cString], &tm))
if (!strftime(buffer, of_pagesize, [format cString], &tm))
@throw [OFOutOfRangeException newWithClass: isa];
ret = [OFString stringWithCString: buf];
ret = [OFString stringWithCString: buffer];
} @finally {
[self freeMemory: buf];
[self freeMemory: buffer];
}
return ret;
}
- (OFDate*)earlierDate: (OFDate*)otherDate
{
|
︙ | | |