1997-10-18 19:49:50 +00:00
|
|
|
/* Test time zone code. */
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2003-03-23 07:06:27 +00:00
|
|
|
#include <Foundation/NSAutoreleasePool.h>
|
1997-10-18 19:49:50 +00:00
|
|
|
#include <Foundation/NSArray.h>
|
|
|
|
#include <Foundation/NSDate.h>
|
|
|
|
#include <Foundation/NSDictionary.h>
|
2002-09-30 16:54:29 +00:00
|
|
|
#include <Foundation/NSTimeZone.h>
|
2004-12-21 23:20:32 +00:00
|
|
|
#include <Foundation/NSCalendarDate.h>
|
1997-10-18 19:49:50 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
main ()
|
|
|
|
{
|
2004-10-11 03:08:54 +00:00
|
|
|
NSTimeZone *system;
|
2004-12-21 23:20:32 +00:00
|
|
|
NSTimeZone *other;
|
|
|
|
NSCalendarDate *date;
|
2003-03-23 07:06:27 +00:00
|
|
|
CREATE_AUTORELEASE_POOL(pool);
|
1997-10-18 19:49:50 +00:00
|
|
|
|
2005-03-15 06:36:21 +00:00
|
|
|
GSPrintf(stdout, @"GMT time zone %x\n",
|
|
|
|
[NSTimeZone timeZoneWithAbbreviation:@"GMT"]);
|
2004-10-11 03:08:54 +00:00
|
|
|
GSPrintf(stdout, @"System time zone\n");
|
|
|
|
system = [NSTimeZone systemTimeZone];
|
|
|
|
GSPrintf(stdout, @" %@\n\n", [system description]);
|
2005-02-22 11:22:44 +00:00
|
|
|
|
2004-10-11 03:08:54 +00:00
|
|
|
GSPrintf(stdout, @"Local time zone:\n %@\n\n",
|
|
|
|
[[NSTimeZone localTimeZone] description]);
|
|
|
|
|
2004-12-21 23:20:32 +00:00
|
|
|
GSPrintf(stdout, @"Time zone for PST (from dict):\n %@\n",
|
|
|
|
[[NSTimeZone abbreviationDictionary] objectForKey: @"PST"]);
|
|
|
|
GSPrintf(stdout, @"Time zones for PST (from map):\n %@\n",
|
2004-10-11 03:08:54 +00:00
|
|
|
[[[NSTimeZone abbreviationMap] objectForKey: @"PST"] description]);
|
|
|
|
|
2004-12-21 23:20:32 +00:00
|
|
|
other = [NSTimeZone timeZoneWithAbbreviation: @"CEST"];
|
|
|
|
GSPrintf(stdout, @"Time zone for CEST:\n %@\n", other);
|
|
|
|
|
|
|
|
date = [[NSCalendarDate alloc] initWithString:@"09/04/2003 17:58:45 CEST"
|
|
|
|
calendarFormat:@"%m/%d/%Y %H:%M:%S %Z"];
|
|
|
|
GSPrintf(stdout, @"Date in CEST:\n %@\n", date);
|
|
|
|
|
2004-10-11 03:08:54 +00:00
|
|
|
|
2003-03-23 07:06:27 +00:00
|
|
|
RELEASE(pool);
|
1997-10-18 19:49:50 +00:00
|
|
|
return 0;
|
|
|
|
}
|