Skip to content

Commit

Permalink
Fix timestamp decoding for 32-bit architectures. (#528)
Browse files Browse the repository at this point in the history
We were converting timestamps to NSInteger, which is a 32-bit or 64-bit
int depending on the architecture. `long long` is guaranteed to be
64-bit wide.

Fixes #525.
  • Loading branch information
tcard authored and ricardopereira committed Nov 1, 2016
1 parent 9d1a8af commit 171fd1d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Source/ARTNSDate+ARTUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@interface NSDate (ARTUtil)

+ (instancetype)artDateFromNumberMs:(NSNumber *)number;
+ (instancetype)artDateFromIntegerMs:(NSInteger)ms;
+ (instancetype)artDateFromIntegerMs:(long long)ms;

- (NSNumber *)artToNumberMs;
- (NSInteger)artToIntegerMs;
Expand Down
4 changes: 2 additions & 2 deletions Source/ARTNSDate+ARTUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

@implementation NSDate (ARTUtil)

+ (instancetype)artDateFromIntegerMs:(NSInteger)ms {
+ (instancetype)artDateFromIntegerMs:(long long)ms {
NSTimeInterval intervalSince1970 = ms / 1000.0;
return [NSDate dateWithTimeIntervalSince1970:intervalSince1970];
}

+ (instancetype)artDateFromNumberMs:(NSNumber *)number {
return [self artDateFromIntegerMs:[number integerValue]];
return [self artDateFromIntegerMs:[number longLongValue]];
}

- (NSNumber *)artToNumberMs {
Expand Down

0 comments on commit 171fd1d

Please sign in to comment.