Important: The information in this document is obsolete and should not be used for new development.
ReadLocation
You can use theReadLocationprocedure 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
TheReadLocationprocedure reads the stored geographic location and time zone of the Macintosh computer from extended parameter RAM and returns it in thelocparameter.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
Fractvalues, giving accuracy to within one foot. For example,a Fractvalue 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
Fractvalues first to theFixeddata type, then to theLongIntdata type. You can use the Mathematical and Logical Utilities routinesFract2FixandFix2Longto accomplish this task.The DST value is a signed byte value that you can use to specify the offset for the
hourfield--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
gmtDeltafield is a 3-byte value contained in a long word, so you must take care to get it properly.SPECIAL CONSIDERATIONS
Although theReadLocationprocedure 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 theReadLocationprocedure 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
Fractdata type and the conversion routinesLong2Fix,Fix2Fract,Fract2Fix, andFix2Long, see the chapter "Mathematical and Logical Utilities" in this book.