on 32bit systems constrain dates to fit

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39549 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2016-03-15 19:04:51 +00:00
parent a2ed652ca2
commit 1db866fde7
4 changed files with 40 additions and 4 deletions

View file

@ -63,6 +63,9 @@
@end
#define DISTANT_FUTURE 63113990400.0
#define DISTANT_PAST -63113817600.0
static NSString *cformat = @"%Y-%m-%d %H:%M:%S %z";
static NSTimeZone *localTZ = nil;
@ -1620,6 +1623,16 @@ static inline int getDigits(const char *from, char *to, int limit, BOOL *error)
format: @"[%@-%@] interval is not a number",
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
}
#if GS_SIZEOF_VOIDP == 4
if (seconds <= DISTANT_PAST)
{
seconds = DISTANT_PAST;
}
else if (seconds >= DISTANT_FUTURE)
{
seconds = DISTANT_FUTURE;
}
#endif
_seconds_since_ref = seconds;
if (_calendar_format == nil)
{

View file

@ -1412,6 +1412,18 @@ otherTime(NSDate* other)
format: @"[%@-%@] interval is not a number",
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
}
#if GS_SIZEOF_VOIDP == 4
if (secs <= DISTANT_PAST)
{
secs = DISTANT_PAST;
}
else if (secs >= DISTANT_FUTURE)
{
secs = DISTANT_FUTURE;
}
#endif
_seconds_since_ref = secs;
return self;
}