mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-10 08:10:49 +00:00
fix configure issue on osx
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@40390 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e3caba204b
commit
80547ce977
2 changed files with 2 additions and 64 deletions
|
@ -1,62 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
* DateFormatTest.m - demonstrate [NSCalendarDate descriptionWithCalendarFormat] hanging behaviour with some values.
|
|
||||||
*
|
|
||||||
* Created on: Mar 15, 2016
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import "Testing.h"
|
|
||||||
|
|
||||||
#define ONE_SECOND ((double)1 / (24*60*60))
|
|
||||||
|
|
||||||
static NSString *
|
|
||||||
formattedDaysSince1970(double daysSince1970)
|
|
||||||
{
|
|
||||||
NSCalendarDate *calendarDate;
|
|
||||||
NSTimeZone *tz;
|
|
||||||
NSString *formattedDate;
|
|
||||||
double secondsSinceReference;
|
|
||||||
|
|
||||||
// Convert offset in "days from 1970" to offset in seconds
|
|
||||||
// from Reference date (from 01-Jan-2001).
|
|
||||||
secondsSinceReference
|
|
||||||
= floor (daysSince1970 / ONE_SECOND - NSTimeIntervalSince1970 + 0.5);
|
|
||||||
|
|
||||||
printf ("daysSince1970: %.18g. secondsSinceReference: %.18g.\n",
|
|
||||||
daysSince1970, secondsSinceReference);
|
|
||||||
|
|
||||||
calendarDate = [[NSCalendarDate alloc]
|
|
||||||
initWithTimeIntervalSinceReferenceDate: secondsSinceReference];
|
|
||||||
tz = [NSTimeZone timeZoneWithName: @"GMT"];
|
|
||||||
[calendarDate setTimeZone: tz];
|
|
||||||
|
|
||||||
formattedDate = [calendarDate descriptionWithCalendarFormat: @"%d-%m-%Y"];
|
|
||||||
RELEASE(calendarDate);
|
|
||||||
return formattedDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
CREATE_AUTORELEASE_POOL(arp);
|
|
||||||
|
|
||||||
if (sizeof(NSInteger) == 4)
|
|
||||||
{
|
|
||||||
PASS_EQUAL(formattedDaysSince1970(8640000000), @"02-01-4001",
|
|
||||||
"format date for 8640000000");
|
|
||||||
|
|
||||||
PASS_EQUAL(formattedDaysSince1970(2147483651), @"02-01-4001",
|
|
||||||
"format date for 2147483651");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PASS_EQUAL(formattedDaysSince1970(8640000000), @"17-07-23657486",
|
|
||||||
"format date for 8640000000");
|
|
||||||
|
|
||||||
PASS_EQUAL(formattedDaysSince1970(2147483651), @"15-07-5881580",
|
|
||||||
"format date for 2147483651");
|
|
||||||
}
|
|
||||||
DESTROY(arp);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -31,14 +31,14 @@
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__APPLE__)
|
|
||||||
|
|
||||||
#if HAVE_OBJC_ROOT_CLASS_ATTRIBUTE
|
#if HAVE_OBJC_ROOT_CLASS_ATTRIBUTE
|
||||||
#define GS_OBJC_ROOT_CLASS __attribute__((objc_root_class))
|
#define GS_OBJC_ROOT_CLASS __attribute__((objc_root_class))
|
||||||
#else
|
#else
|
||||||
#define GS_OBJC_ROOT_CLASS
|
#define GS_OBJC_ROOT_CLASS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__APPLE__)
|
||||||
|
|
||||||
/* Provide dummy implementations for NSObject and NSConstantString
|
/* Provide dummy implementations for NSObject and NSConstantString
|
||||||
* for libobjc2 which needs them.
|
* for libobjc2 which needs them.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue