From bffcc464607cee74a07aca7d4b513f32c309b806 Mon Sep 17 00:00:00 2001 From: fedor Date: Tue, 24 Jun 2003 03:47:19 +0000 Subject: [PATCH] In NSTimeZones git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17012 72102866-910b-0410-8b05-ffd578937521 --- Testing/create-abbrevs.m | 58 ------------------------- Testing/create-regions.m | 93 ---------------------------------------- 2 files changed, 151 deletions(-) delete mode 100644 Testing/create-abbrevs.m delete mode 100644 Testing/create-regions.m diff --git a/Testing/create-abbrevs.m b/Testing/create-abbrevs.m deleted file mode 100644 index d757eca80..000000000 --- a/Testing/create-abbrevs.m +++ /dev/null @@ -1,58 +0,0 @@ -/* create-abbrevs.m - Utility to create a list of time zones and their - associated abbreviations. - - Copyright (C) 1997 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include -#include -#include -#include -#include -#include -#include -#include - -int -main (int argc, char *argv[]) -{ - int i; - id pool, zone, dict, e, details, name; - - pool = [NSAutoreleasePool new]; - - for (i = 1; i < argc; i++) - { - name = [NSString stringWithUTF8String: argv[i]]; - zone = [NSTimeZone timeZoneWithName: name]; - if (zone != nil) - { - id detail, abbrev; - - dict = [NSMutableDictionary dictionary]; - details = [zone timeZoneDetailArray]; - e = [details objectEnumerator]; - while ((detail = [e nextObject]) != nil) - [dict setObject: name forKey: [detail timeZoneAbbreviation]]; - e = [dict keyEnumerator]; - while ((abbrev = [e nextObject]) != nil) - printf("%s\t%s\n", [abbrev UTF8String], [name UTF8String]); - } - } - - [pool release]; - return 0; -} diff --git a/Testing/create-regions.m b/Testing/create-regions.m deleted file mode 100644 index 72a358a77..000000000 --- a/Testing/create-regions.m +++ /dev/null @@ -1,93 +0,0 @@ -/* create-regions.m - Utility to create a list of time zones and their - associated latitudinal region. - - Copyright (C) 1997 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#include -#include -#include -#include -#include -#include -#include - -#define HOURSECS (60*60) /* Seconds in 1 hour. */ -#define DAYSECS (HOURSECS*24) /* Seconds in 24 hours. */ -#define N (360/15) /* Each latitudinal region is separated by 15 degrees */ - -int -main (int argc, char *argv[]) -{ - int i; - id pool, name, zone; - id zones[N]; - - pool = [NSAutoreleasePool new]; - for (i = 0; i < N; i++) - zones[i] = nil; - - /* Obtain the regions for each latitudinal region. */ - for (i = 1; i < argc; i++) - { - name = [NSString stringWithUTF8String: argv[i]]; - zone = [NSTimeZone timeZoneWithName: name]; - if (zone != nil) - { - int offset, index; - id details, detail, e; - - details = [zone timeZoneDetailArray]; - - /* Get a standard time. */ - e = [details objectEnumerator]; - while ((detail = [e nextObject]) != nil) - { - if (![detail isDaylightSavingTimeZone]) - break; - } - - if (detail == nil) - /* If no standard time. */ - detail = [details objectAtIndex: 0]; - - offset = [detail timeZoneSecondsFromGMT]; - - /* Get index from normalized offset */ - index = ((offset+DAYSECS)%DAYSECS)/HOURSECS; - - if (zones[index] == nil) - zones[index] = [NSMutableArray array]; - [zones[index] addObject: [zone timeZoneName]]; - } - } - - /* Write regions to file. */ - for (i = 0; i < N; i++) - { - id e, name; - - if (zones[i] != nil) - { - e = [zones[i] objectEnumerator]; - while ((name = [e nextObject]) != nil) - printf("%d %s\n", i, [name UTF8String]); - } - } - - [pool release]; - return 0; -}