Important: The information in this document is obsolete and should not be used for new development.
SetTime
You can use theSetTimeprocedure to modify the date-time information in the clock chip. TheSetTimerequires that the new date-time information be passed to the function as a date and time.
PROCEDURE SetTime (d: DateTimeRec);
d- The date and time to which to set the clock chip.
DESCRIPTION
TheSetTimeprocedure writes the date and time specified by thedparameter to the clock chip. TheSetTimeprocedure first converts the date and time to the number of seconds elapsed since midnight, January 1, 1904 (by calling theDateToSecondsprocedure). It then writes these seconds to the clock chip and to the system global variableTime(by calling theSetDateTimefunction).As an alternative to using the
SetTimeprocedure, you can use theDateToSecondsandSetDateTimeroutines.
- Note
- The
SetTimeprocedure 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 theSetDateTimefunction.![]()
SEE ALSO
See page 4-23 for a description of the fields of a date-time record. For more information on theDateToSecondsprocedure, see page 4-39. TheSetDateTimefunction is described on page 4-36. For sample code that uses theSetTimeprocedure to write date-time information (represented as a date and time) to the clock-chip, see Listing 4-4 on page 4-11.