![]() |
ReadLocation |
||||
Header: | OSUtils.h | Carbon status: | Supported | |
Obtains information about a geographic location or time zone.
void ReadLocation ( MachineLocation *loc );
On return, the fields of the geographic location structure containing the geographic location and the time-zone information.The ReadLocation procedure reads the stored geographic location and time zone of the Macintosh computer from extended parameter RAM.
You can get values for the latitude, longitude, daylight savings time (DST), or Greenwich mean time (GMT). If the geographic location record has never been set, all fields contain 0.
The latitude and longitude are stored as Fract values, giving accuracy to within one foot. For example, a Fract value of 1.0 equals 90 degrees; 1.0 equals 90 degrees; and 2.0 equals 180 degrees.
To convert these values to a degrees format, you need to convert the Fract values first to the Fixed data type, then to the LongInt data type. Use the Mathematical and Logical Utilities functions Fract2Fix and Fix2Long to accomplish this task.
The DST value is a signed byte value that specifies the offset for the hour fieldwhether to add one hour, subtract one hour, or make no change at all.
The GMT value is in seconds east of GMT. For example, San Francisco is at 28,800 seconds (8 hours * 3,600 seconds per hour) east of GMT. The gmtDelta field is a 3-byte value contained in a long word, so you must take care to get it properly.
The ReadLocation function was previously available with the Script Manager.
For more information on the geographic location record, see MachineLocation.
For more information on the Fract data type and the conversion routines Long2Fix, Fix2Fract, Fract2Fix, and Fix2Long, see Mathematical and Logical Utilities.
Do not call the ReadLocation function at interrupt time.
Supported in Carbon. Available in CarbonLib 1.0 and later when InterfaceLib 7.1 or later is installed. Exported by CarbonLib 1.0 and later and by InterfaceLib 7.1 and later.