Important: The information in this document is obsolete and should not be used for new development.
SetDateTime
You can use theSetDateTime
function to modify the date-time information stored in the clock chip. TheSetDateTime
function requires that the new date-time information be passed to the function as the number of seconds elapsed since midnight, January 1, 1904.
FUNCTION SetDateTime (time: LongInt): OSErr;
time
- The number of seconds elapsed since midnight, January 1, 1904; this value is written to the clock chip.
DESCRIPTION
TheSetDateTime
function writes the number of seconds, specified by thetime
parameter, to the clock chip. TheSetDateTime
function also updates the low-memory copy of the date-time information.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, theSetDateTime
function returns either theclkRdErr
result code, because the clock chip could not be read, or theclkWrErr
result code, because the time written to the clock chip could not be verified. Otherwise, the function returns thenoErr
result code.ASSEMBLY-LANGUAGE INFORMATION
You must set up register D0 with the number of seconds to which you wish to change the clock chip. When theSetDateTime
function returns, register D0 contains the result code.The registers on entry and exit for this routine are
Registers on entry D0 Seconds elapsed since midnight, January 1, 1904
Registers on exit D0 Result code RESULT CODES
noErr 0 No error clkRdErr -85 Unable to read clock clkWrErr -86 Time written did not verify SEE ALSO
For sample code that uses theSetDateTime
function to write date-time information (represented as a number of seconds) to the clock-chip, see Listing 4-3 on page 4-11.