home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / win_lrn / time / gettimer.asm < prev    next >
Encoding:
Assembly Source File  |  1988-08-11  |  582 b   |  36 lines

  1. ; get the time more efficiently than cmerge and DOSCALL() do
  2.  
  3. include cmacros.inc
  4.  
  5. time    struc
  6.     hour    dw  ?
  7.     minute    dw  ?
  8.     second    dw  ?
  9. time    ends
  10.  
  11. assumes CS,CODE
  12. assumes DS,DATA
  13.  
  14. sBegin     CODE
  15.  
  16. cProc    GetTime, <PUBLIC, NEAR>
  17.     parmW    pTime            ; pointer to the structure to fill
  18. cBegin
  19.     mov    ax, 2c00h        ; get time
  20.     int    21h
  21.     mov    bx, pTime
  22.     cmp    ch, 12            ; if hour <12
  23.     jl    lt12            ; we're ok
  24.     sub    ch,12            ; else adjust it
  25. lt12:
  26.     xor    ax,ax
  27.     mov    al,ch
  28.     mov    [bx].hour, ax
  29.     mov    al,cl
  30.     mov    [bx].minute, ax
  31.     mov    al,dh
  32.     mov    [bx].second, ax
  33. cEnd
  34. sEnd    CODE
  35.     END
  36.