Carbon


SetDateTime

Header: DateTimeUtils.h Carbon status: Supported

Changes the date-time information stored in the clock chip to the specified value, expressed as the number of seconds elapsed since midnight, January 1, 1904.

OSErr SetDateTime (
    UInt32 time
);
Parameter descriptions
time

The number of seconds elapsed since midnight, January 1, 1904; this value is written to the clock chip.

function result

A result code. The SetDateTime function attempts to verify the value written by reading it back in and comparing it to the value in the low-memory copy. If a problem occurs, the SetDateTime function returns either the clkRdErr result code, because the clock chip could not be read, or the clkWrErr result code, because the time written to the clock chip could not be verified. Otherwise, the function returns the noErr result code.

DISCUSSION

The SetDateTime function also updates the low-memory copy of the date-time information.

Users can change the current date and time stored in both the system global variable Time and in the clock chip by using the General Controls control panel, Date & Time control panel, or the Alarm Clock desk accessory. In general, your application should not directly change the current date-time information. If your application does need to modify the current date-time information, it should instruct the user how to change the date and time.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)