;       SCCSID = @(#)demtime.asm	6.2 91/12/13

        page    ,132
        title   TIME - time and date functions

NAME    DEMTIME

;
; System Calls and low level routines for DATE and TIME
;
;   $GET_DATE
;   $SET_DATE
;   $GET_TIME
;   $SET_TIME
;
;   Modification history:
;
;       Created: ARR 30 March 1983
;       Modified for MVDM by danno 16-Feb-1989
;

.xlist
;
; get the appropriate segment definitions
;
include v86seg.inc
.xcref
include basemaca.inc
include osmaca.inc
include demmac.inc
include dossymc.inc
include mvdmexp.inc
include demsvc.inc
.cref
.list
        CpuMode 386

V86CODE     SEGMENT
        ASSUME  CS:V86GROUP

        EXTRN       Get_User_Stack:NEAR



SUBTTL DATE AND TIME - SYSTEM CALLS 42,43,44,45
        PAGE

; Inputs:
;       None
; Function:
;       Return current date
; Returns:
;       Date in CX:DX

procedure $GET_DATE,NEAR
        ASSUME  ds:NOTHING,es:NOTHING

        ;entry: none
        SVC     SVC_DEMQUERYDATE        ; Get the date
        ;exit:  DH=month 1..12
        ;       DL=day 1..31
        ;       CX=year 1980..2099
        ;       AL=weekday 0..6

        invoke  get_user_stack          ;Get pointer to user registers
        MOV     [SI.user_DX],DX         ;DH=month, DL=day
        MOV     [SI.user_CX],CX         ;CX=year
        ret
EndProc $GET_DATE


        procedure   $SET_DATE,NEAR      ;System call 43
ASSUME  DS:NOTHING,ES:NOTHING

; Inputs:
;       CX:DX valid date
; Function:
;       Set current date
; Returns:
;       AL = -1 date bad, = 0 OK\

        SVC     SVC_DEMSETDATE

        ret
EndProc $SET_DATE


        procedure   $GET_TIME,NEAR      ;System call 44
ASSUME  DS:NOTHING,ES:NOTHING

; Inputs:
;       None
; Function:
;       Get current time
; Returns:
;       Time in CX:DX

        SVC     SVC_DEMQUERYTIME
        invoke  get_user_stack          ;Get pointer to user registers
        MOV     [SI.user_DX],DX
        MOV     [SI.user_CX],CX
        XOR     AL,AL
RET26:  ret
EndProc $GET_TIME

        procedure   $SET_TIME,NEAR      ;System call 45
ASSUME  DS:NOTHING,ES:NOTHING

; Inputs:
;       CX:DX = Time
; Function:
;       Set time
; Returns:
;       AL = -1 time bad, = 0 OK

        SVC     SVC_DEMSETTIME
        ret
EndProc $SET_TIME

V86CODE      ENDS
    END
