home *** CD-ROM | disk | FTP | other *** search
- page 58,132
-
- ; time.asm
- ; contains: fastdate(),fasttime(),fetchtime()
- ;
- include model.h
- include prologue.h
- include equ.h
-
- pseg fastdate
-
- ;==>-- int fastdate(td)
- ;
- ;; ARGUMENTS:
- ; (struct TIMEDATE *) td - points to time date structure
- ;
- ;; DESCRIPTION:
- ; Get system time and put in structure
- ;
- ;; RETURNS:
- ; Day of month 0..31
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc fastdate
- mov ah,2ah ;dos get date function
- int 21h
- if _LDATA
- push ds
- lds bx,parm1_
- else
- mov bx,parm1_
- endif
- mov [bx+year],cx ;save year
- xor ah,ah
- mov al,dh ;ax=month
- mov [bx+month],ax
- mov al,dl ;ax=day
- mov [bx+day],ax ;return with day in ax
- if _LDATA
- pop ds
- endif
- cproce
-
- ;==>-- int fasttime(td)
- ;
- ;; ARGUMENTS:
- ; (struct TIMEDATE *) td - points to time date structure
- ;
- ;; DESCRIPTION:
- ; Get system time and put in structure
- ;
- ;; RETURNS:
- ; day of week (0..6)
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc fasttime
- mov ah,2ch ;get time function
- int 21h
- if _LDATA
- push ds
- lds bx,parm1_
- else
- mov bx,parm1_
- endif
- xor ah,ah
- mov al,ch ;ax=hour
- mov [bx+hours],ax
- mov al,cl ;ax=minutes
- mov [bx+minutes],ax
- mov al,dh ;ax=seconds
- mov [bx+seconds],ax
- mov al,dl ;ax=hundredths/sec
- mov [bx+hsecs],ax
- if _LDATA
- pop ds
- endif
- mov ah,2ah
- int 21h ;get date (day of week to AL)
- xor ah,ah
- cproce
-
- ;==>-- int fetchtime(td)
- ;
- ;; ARGUMENTS:
- ; (struct TIMEDATE *) td - points to time date structure
- ;
- ;; DESCRIPTION:
- ; Get system date and time to structure
- ;
- ;; RETURNS:
- ; day of week, 0=Sun, 1=Mon etc.
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc fetchtime,,fetchtim
- mov ah,2ch ;get time function
- int 21h
- if _LDATA
- push ds
- lds bx,parm1_
- else
- mov bx,parm1_
- endif
- xor ah,ah
- mov al,ch ;ax=hour
- mov [bx+hours],ax
- mov al,cl ;ax=minutes
- mov [bx+minutes],ax
- mov al,dh ;ax=seconds
- mov [bx+seconds],ax
- mov al,dl ;ax=hundredths/sec
- mov [bx+hsecs],ax
- push bx
- mov ah,2ah ;dos get date function
- int 21h
- pop bx
- push ax
- mov [bx+year],cx ;save year
- xor ah,ah
- mov al,dh ;ax=month
- mov [bx+month],ax
- mov al,dl ;ax=day
- mov [bx+day],ax
- pop ax
- xor ah,ah ;return with day of week in ax
- if _LDATA
- pop ds
- endif
- cproce
- endps
- end
-