mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-21 15:31:17 +00:00
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20909 72102866-910b-0410-8b05-ffd578937521
43 lines
1.3 KiB
Objective-C
43 lines
1.3 KiB
Objective-C
/* Test time zone code. */
|
|
|
|
#include <stdio.h>
|
|
#include <Foundation/NSAutoreleasePool.h>
|
|
#include <Foundation/NSArray.h>
|
|
#include <Foundation/NSDate.h>
|
|
#include <Foundation/NSDictionary.h>
|
|
#include <Foundation/NSTimeZone.h>
|
|
#include <Foundation/NSCalendarDate.h>
|
|
|
|
int
|
|
main ()
|
|
{
|
|
NSTimeZone *system;
|
|
NSTimeZone *other;
|
|
NSCalendarDate *date;
|
|
CREATE_AUTORELEASE_POOL(pool);
|
|
|
|
GSPrintf(stdout, @"GMT time zone %x\n",
|
|
[NSTimeZone timeZoneWithAbbreviation:@"GMT"]);
|
|
GSPrintf(stdout, @"System time zone\n");
|
|
system = [NSTimeZone systemTimeZone];
|
|
GSPrintf(stdout, @" %@\n\n", [system description]);
|
|
|
|
GSPrintf(stdout, @"Local time zone:\n %@\n\n",
|
|
[[NSTimeZone localTimeZone] description]);
|
|
|
|
GSPrintf(stdout, @"Time zone for PST (from dict):\n %@\n",
|
|
[[NSTimeZone abbreviationDictionary] objectForKey: @"PST"]);
|
|
GSPrintf(stdout, @"Time zones for PST (from map):\n %@\n",
|
|
[[[NSTimeZone abbreviationMap] objectForKey: @"PST"] description]);
|
|
|
|
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);
|
|
|
|
|
|
RELEASE(pool);
|
|
return 0;
|
|
}
|