Int 21H [1.0] Function 2DH (45) Set time

Initializes the system real-time clock to a specified hour, minute, second, and hundredth of second. The system date is not affected.

Call with:

AH = 2DH

CH = hours (0 through 23)

CL = minutes (0 through 59)

DH = seconds (0 through 59)

DL = hundredths of seconds (0 through 99)

Returns:

AL = 00H if time set successfully

FFH if time not valid (ignored)

Note:

This function's register format is the same as that required for Int 21H Function 2CH (Get Time).

Example:

Set the system time according to the contents of the variables hours and minutes. Force the current seconds and hundredths of seconds to zero.

hours db 0

minutes db 0

.

.

.

mov ah,2dh ; function number

mov ch,hours ; get hours (byte)

mov cl,minutes ; get minutes (byte)

mov dx,0 ; force seconds and

; hundredths to zero

int 21h ; transfer to MS-DOS

or al,al ; check status

jnz error ; jump if time invalid

.

.

.