aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks
diff options
context:
space:
mode:
Diffstat (limited to 'Frameworks')
-rw-r--r--Frameworks/PostgresKit/Resources/TestData.sql4
-rw-r--r--Frameworks/PostgresKit/Source/PGPostgresTimeTZ.h4
-rw-r--r--Frameworks/PostgresKit/Source/PGPostgresTimeTZ.m29
-rw-r--r--Frameworks/PostgresKit/Source/PostgresKit.h1
4 files changed, 32 insertions, 6 deletions
diff --git a/Frameworks/PostgresKit/Resources/TestData.sql b/Frameworks/PostgresKit/Resources/TestData.sql
index e351f43f..574d1702 100644
--- a/Frameworks/PostgresKit/Resources/TestData.sql
+++ b/Frameworks/PostgresKit/Resources/TestData.sql
@@ -58,9 +58,9 @@ VALUES (
'VARCHAR',
'08-04-1987',
'02:02:02',
- '02:02:02 GMT',
+ '02:02:02 +1000',
'08-04-1987 02:02:02',
- '08-04-1987 02:02:02 GMT');
+ '08-04-1987 02:02:02 +0000');
COMMIT;
diff --git a/Frameworks/PostgresKit/Source/PGPostgresTimeTZ.h b/Frameworks/PostgresKit/Source/PGPostgresTimeTZ.h
index 075ffbb0..0101ffa3 100644
--- a/Frameworks/PostgresKit/Source/PGPostgresTimeTZ.h
+++ b/Frameworks/PostgresKit/Source/PGPostgresTimeTZ.h
@@ -48,12 +48,12 @@
/**
* @property date The date instance that holds the time.
*/
-@property (readonly) NSDate *date;
+@property (readwrite, retain) NSDate *date;
/**
* @property timeZone The time zone of the associated time.
*/
-@property (readonly) NSTimeZone *timeZone;
+@property (readwrite, retain) NSTimeZone *timeZone;
+ (PGPostgresTimeTZ *)timeWithDate:(NSDate *)date timeZoneGMTOffset:(NSUInteger)offset;
diff --git a/Frameworks/PostgresKit/Source/PGPostgresTimeTZ.m b/Frameworks/PostgresKit/Source/PGPostgresTimeTZ.m
index d2d91898..c4f14eb5 100644
--- a/Frameworks/PostgresKit/Source/PGPostgresTimeTZ.m
+++ b/Frameworks/PostgresKit/Source/PGPostgresTimeTZ.m
@@ -57,9 +57,10 @@
- (id)initWithDate:(NSDate *)date timeZoneGMTOffset:(NSUInteger)offset
{
if ((self = [super init])) {
- _date = date;
_hasDate = NO;
- _timeZone = [NSTimeZone timeZoneForSecondsFromGMT:offset];
+
+ [self setDate:date];
+ [self setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:offset]];
}
return self;
@@ -67,6 +68,20 @@
#pragma mark -
+- (NSUInteger)hash
+{
+ return [_date hash] ^ [_timeZone hash];
+}
+
+- (BOOL)isEqual:(id)object
+{
+ if (object == self) return YES;
+
+ if (!object || ![object isKindOfClass:[self class]]) return NO;
+
+ return [_date isEqualToDate:[(PGPostgresTimeTZ *)object date]] && [_timeZone isEqualToTimeZone:[(PGPostgresTimeTZ *)object timeZone]];
+}
+
- (NSString *)description
{
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
@@ -81,4 +96,14 @@
return [NSString stringWithFormat:@"%@ %@", output, [_timeZone abbreviation]];
}
+#pragma mark -
+
+- (void)dealloc
+{
+ if (_date) [_date release], _date = nil;
+ if (_timeZone) [_timeZone release], _timeZone = nil;
+
+ [super dealloc];
+}
+
@end
diff --git a/Frameworks/PostgresKit/Source/PostgresKit.h b/Frameworks/PostgresKit/Source/PostgresKit.h
index 4189fffe..49d15b09 100644
--- a/Frameworks/PostgresKit/Source/PostgresKit.h
+++ b/Frameworks/PostgresKit/Source/PostgresKit.h
@@ -20,6 +20,7 @@
#import "PGPostgresError.h"
#import "PGPostgresResult.h"
+#import "PGPostgresTimeTZ.h"
#import "PGPostgresStatement.h"
#import "PGPostgresException.h"
#import "PGPostgresConnection.h"