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 / Setting the Current Date and Time


You can use the SetTime procedure to modify the date-time information in the clock chip. The SetTime requires that the new date-time information be passed to the function as a date and time.

PROCEDURE SetTime (d: DateTimeRec);
The date and time to which to set the clock chip.
The SetTime procedure writes the date and time specified by the d parameter to the clock chip. The SetTime procedure first converts the date and time to the number of seconds elapsed since midnight, January 1, 1904 (by calling the DateToSeconds procedure). It then writes these seconds to the clock chip and to the system global variable Time (by calling the SetDateTime function).

As an alternative to using the SetTime procedure, you can use the DateToSeconds and SetDateTime routines.

The SetTime procedure does not return a result code. If you need to know whether an attempt to change the date and time information in the clock chip is successful, you must use the SetDateTime function.
See page 4-23 for a description of the fields of a date-time record. For more information on the DateToSeconds procedure, see page 4-39. The SetDateTime function is described on page 4-36. For sample code that uses the SetTime procedure to write date-time information (represented as a date and time) to the clock-chip, see Listing 4-4 on page 4-11.

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.

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