ObjFW  Diff

Differences From Artifact [2b9c35d972]:

To Artifact [c0e29e0a91]:


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
18
19
20
21
22
23
24

25
26
27
28
29
30
31







-








#define _GNU_SOURCE
#include <stdint.h>
#include <limits.h>
#include <time.h>
#include <math.h>
#include <float.h>
#include <assert.h>

#include <sys/time.h>

#import "OFDate.h"
#import "OFString.h"
#import "OFDictionary.h"
#import "OFXMLElement.h"
215
216
217
218
219
220
221
222

223
224
225
226
227
228
229
214
215
216
217
218
219
220

221
222
223
224
225
226
227
228







-
+








- init
{
	struct timeval t;

	self = [super init];

	assert(!gettimeofday(&t, NULL));
	OF_ENSURE(!gettimeofday(&t, NULL));

	seconds = t.tv_sec;
	seconds += (double)t.tv_usec / 1000000;

	return self;
}

621
622
623
624
625
626
627
628

629
630
631
632
633
634
635
636
637
638
639
640
620
621
622
623
624
625
626

627
628
629
630
631
632
633
634
635
636
637
638
639







-
+












}

- (double)timeIntervalSinceNow
{
	struct timeval t;
	double seconds_;

	assert(!gettimeofday(&t, NULL));
	OF_ENSURE(!gettimeofday(&t, NULL));

	seconds_ = t.tv_sec;
	seconds_ += (double)t.tv_usec / 1000000;

	return seconds - seconds_;
}

- (OFDate*)dateByAddingTimeInterval: (double)seconds_
{
	return [OFDate dateWithTimeIntervalSince1970: seconds + seconds_];
}
@end