home *** CD-ROM | disk | FTP | other *** search
- This time zone data comes from tzdata1996m.tar.gz available at
- elsie.nci.nih.gov. Send information or corrections on the contents
- of the time zone files to the mail alias tz@elsie.nci.nih.gov.
-
- ==========================================================
-
- How to Update the Foundation Time Zone Data Files
-
- 1. Download the time zone compiler and meta-data files from
- ftp://elsie.nci.nih.gov/pub. The files are named tzcode*.tar.gz
- and tzdata*.tar.gz, where the "*" part changes as updates are made.
- Unpack the archives into a new directory (it works best to unpack
- them into the same directory).
-
- 2. Compile the time zone compiler (zic) from the tzcode archive.
- Changes to the Makefile and/or configuration aren't usually necessary,
- but changing the definition of TOPDIR in the Makefile (to /tmp or
- /temp, for example) makes the next step somewhat simpler. You may
- need to change zic.c to provide definitions for S_IWGRP, S_IWOTH,
- F_OK, and perhaps other macros.
-
- 3. Using the zic just compiled, compile the data files. This is
- simple if you drop the files from tzdata*.tar.gz into the top level
- of the directory you unarchived the tzcode archive into. Use the
- make target "posix_only". The data files will be put into the
- /etc/zoneinfo directory under the directory specified by TOPDIR in
- the Makefile.
-
- 4. Create a serialized property list from the new time zone data.
- This step is optional, but improves use of disk space on a FAT
- file system or other file system with large block sizes (on a FAT
- file system with a 16K block, the raw time zone data consumes ~8M
- of real space while the serialized file consumes ~250K, a factor
- of 32). A program which creates such a serialized property list
- is located at the bottom of this file (specify the path to the
- newly compiled time zones, ${TOPDIR}/etc/zoneinfo, as an argument).
- If it exists, the serialized file takes precedence over the
- individual time zone files.
-
- 5. If you did step 4, move the TimeZones.splist file to the
- Foundation's TimeZoneInfo directory. Go to step 7.
-
- 6. If you did not do step 4, move the Foundation's TimeZoneInfo
- directory out of the way. Then move ${TOPDIR}/etc/zoneinfo to
- the previous location of TimeZoneInfo and name the resulting
- directory TimeZoneInfo. Finally, copy these files from the old
- TimeZoneInfo directory into the new:
- Abbreviation.table
- OldTZToNewTZ.table
- README.TimeZoneInfo
- WindowsName.table
-
- 7. You may want to make sure that all the "value strings" in the
- WindowsName.table property list still exist as keys within the
- new serialized property list or as files within the new
- TimeZoneInfo directory (depending on whether you did step 4).
- The serialized file can be dumped into the ASCII property list
- format with the "pl -input TimeZones.splist" command at a command
- prompt. The OldTZToNewTZ.table is for mapping time zone files that
- no longer exist to existant time zone files. Some sites may wish
- to customize the Abbreviation.table. If you need to edit any of
- these tables, we recommend using TextEdit or other Unicode-capable
- editor. The table files are Unicode (and should stay that way).
-
-
- That's it!
-
- Note that updating the time zone information may create some
- compatibility issues (two machines may believe different things
- about summer/daylight saving time for the same location and
- date, validity of archives with archived time zones which no
- longer exist, etc.).
-
-
- ==========================================================
-
- #import <Foundation/Foundation.h>
-
- // Create a serialized dictionary from a time zone data directory.
- // The keys are the names of the time zones and the values are
- // data objects containing the compiled information for each time
- // zone. Run with an argument specifying the top level directory
- // where the compiled time zone information is. The output file
- // will be put in a file called TimeZones.splist in the current
- // directory.
-
- void main() {
- id pool = [[NSAutoreleasePool allocWithZone:NULL] init];
- id fm, subpaths, arg, args, sd, dict, datas, cd;
- unsigned int idx;
-
- args = [[NSProcessInfo processInfo] arguments];
- if ([args count] < 2) {
- NSLog(@"Too few arguments -- specify a path to the time zone information");
- exit(1);
- }
- arg = [args objectAtIndex:1];
- fm = [NSFileManager defaultManager];
- subpaths = [fm subpathsAtPath:arg];
- cd = [fm currentDirectoryPath];
- [fm changeCurrentDirectoryPath:arg];
- datas = [NSMutableArray array];
- for (idx = 0; idx < [subpaths count]; idx++) {
- id data = [NSData dataWithContentsOfFile:[subpaths objectAtIndex:idx]];
- data ? [datas addObject:data] : [subpaths removeObjectAtIndex:idx--];
- }
- dict = [NSDictionary dictionaryWithObjects:datas forKeys:subpaths];
- sd = [NSSerializer serializePropertyList:dict];
- [fm changeCurrentDirectoryPath:cd];
- [sd writeToFile:@"TimeZones.splist" atomically:NO];
- [pool release];
- exit(0);
- }
-