Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Previous Book Contents Book Index Next

Inside Macintosh: Operating System Utilities /
Chapter 4 - Date, Time, and Measurement Utilities / Date, Time, and Measurement Utilities Reference
Routines / Reading and Writing Location Data


WriteLocation

You can use the WriteLocation procedure to change the geographic location or time-zone information stored in extended parameter RAM.

PROCEDURE WriteLocation (loc: MachineLocation);
loc
The geographic location and time-zone information to write to the extended parameter RAM.
DESCRIPTION
The WriteLocation procedure takes the geographic location and time-zone information, specified in the loc parameter, and writes it to the extended parameter RAM.

The latitude and longitude are stored in the geographic location record as Fract values, giving accuracy to within 1 foot. For example, a Fract value of 1.0 equals 90 degrees; -1.0 equals -90 degrees; and -2.0 equals -180 degrees.

To store latitude and longitude values, you need to convert them first to the Fixed data type, then to the Fract data type. You can use the Operating System Utilities routines Long2Fix and Fix2Fract to accomplish this task. Listing 4-8 on page 4-19 shows a procedure that converts San Francisco's latitude and longitude to Fract values, then writes the Fract values to extended parameter RAM using the WriteLocation procedure.

The daylight savings time 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 Greenwich mean time 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 set it properly. When writing gmtDelta, you should mask off the top byte because it is reserved. In addition, you should preserve the value of dlsDelta. Listing 4-10 on page 4-21 shows a procedure that writes gmtDelta, with the top byte masked off, while preserving the value of dlsDelta.

SPECIAL CONSIDERATIONS
Although WriteLocation 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 more information on the Fract data type and the conversion routines Long2Fix, Fix2Fract, Fract2Fix, and Fix2Long, see the chapter "Mathematical and Logical Utilities" in this book.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996

Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2004 Apple Computer, Inc.
All rights reserved. | Terms of use | Privacy Notice