Important: The information in this document is obsolete and should not be used for new development.
ReadLocation
You can use theReadLocation
procedure to get information about a geographic location or time zone.
PROCEDURE ReadLocation (VAR loc: MachineLocation);
loc
- On return, the fields of the geographic location record containing the geographic location and the time-zone information.
DESCRIPTION
TheReadLocation
procedure reads the stored geographic location and time zone of the Macintosh computer from extended parameter RAM and returns it in theloc
parameter.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 theFixed
data type, then to theLongInt
data type. You can use the Mathematical and Logical Utilities routinesFract2Fix
andFix2Long
to accomplish this task.The DST value is a signed byte value that you can use to specify the offset for the
hour
field--whether 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.SPECIAL CONSIDERATIONS
Although theReadLocation
procedure does not move or purge memory, you should not call it at interrupt time.SEE ALSO
For more information on the geographic location record, see page 4-29. For an example of how to use theReadLocation
procedure to get latitude and longitude, see Listing 4-8 on page 4-19. Listing 4-9 on page 4-20 shows an application-defined procedure for obtaining the value ofgmtDelta
.For more information on the
Fract
data type and the conversion routinesLong2Fix
,Fix2Fract
,Fract2Fix
, andFix2Long
, see the chapter "Mathematical and Logical Utilities" in this book.