aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/PostgresKit/Source/PGPostgresTimeTZ.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2013-01-31 21:45:24 +0000
committerstuconnolly <stuart02@gmail.com>2013-01-31 21:45:24 +0000
commitba5a0d6b416971b386896088e227e2ec4110b2a3 (patch)
treef62c11d8044a6d648dbb689fcecd1007cc609aa5 /Frameworks/PostgresKit/Source/PGPostgresTimeTZ.m
parent4d09d6c010fac04e9b589ae53e6b272d369ad62b (diff)
downloadsequelpro-ba5a0d6b416971b386896088e227e2ec4110b2a3.tar.gz
sequelpro-ba5a0d6b416971b386896088e227e2ec4110b2a3.tar.bz2
sequelpro-ba5a0d6b416971b386896088e227e2ec4110b2a3.zip
PostgresKit: Update test data and fix not retaining timestamp properties.
Diffstat (limited to 'Frameworks/PostgresKit/Source/PGPostgresTimeTZ.m')
-rw-r--r--Frameworks/PostgresKit/Source/PGPostgresTimeTZ.m29
1 files changed, 27 insertions, 2 deletions
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