Skip to content

Commit

Permalink
Add time zone support to GTCommit.
Browse files Browse the repository at this point in the history
  • Loading branch information
boidanny committed Mar 28, 2013
1 parent f68813d commit 63ee416
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions Classes/GTCommit.h
Expand Up @@ -44,6 +44,7 @@
@property (nonatomic, readonly) NSString *messageDetails;
@property (nonatomic, readonly) NSString *messageSummary;
@property (nonatomic, readonly) NSDate *commitDate;
@property (nonatomic, readonly) NSTimeZone *commitTimeZone;
@property (nonatomic, readonly) GTTree *tree;

+ (GTCommit *)commitInRepository:(GTRepository *)theRepo updateRefNamed:(NSString *)refName author:(GTSignature *)authorSig committer:(GTSignature *)committerSig message:(NSString *)newMessage tree:(GTTree *)theTree parents:(NSArray *)theParents error:(NSError **)error;
Expand Down
9 changes: 8 additions & 1 deletion Classes/GTCommit.m
Expand Up @@ -122,7 +122,14 @@ - (NSString *)messageSummary {

- (NSDate *)commitDate {
git_time time = (git_time){.time = git_commit_time(self.git_commit), .offset = git_commit_time_offset(self.git_commit)};
return [NSDate gt_dateFromGitTime:time];
return [NSDate gt_dateFromGitTime:time timeZone:NULL];
}

- (NSTimeZone *)commitTimeZone {
NSTimeZone *timeZone = nil;
git_time time = (git_time){.time = git_commit_time(self.git_commit), .offset = git_commit_time_offset(self.git_commit)};
[NSDate gt_dateFromGitTime:time timeZone:&timeZone];
return timeZone;
}

- (GTSignature *)author {
Expand Down

0 comments on commit 63ee416

Please sign in to comment.