home *** CD-ROM | disk | FTP | other *** search
- /*
- * xtime.c
- *
- */
-
- #pragma inline
- #include <dos.h>
- #include <stdio.h>
-
- unsigned char hour, min, sec;
-
- void ConvBinary()
- {
- asm {
- mov bl, al
- and bl, 0fh
- shr al, 1
- shr al, 1
- shr al, 1
- shr al, 1
- mov ah, 10
- mul ah
- add al, bl
- }
- }
-
- void GetTime()
- {
- asm {
- mov ah, 2
- int 1ah
- mov al, ch
- call ConvBinary
- mov hour, al
- mov al, cl
- call ConvBinary
- mov min, al
- mov al, dh
- call ConvBinary
- mov sec, al
- }
- }
- void main(int argc, char *argv[])
- {
- unsigned highBefore, highAfter, lowBefore, lowAfter;
- unsigned long t1, t2;
- float i, k, xt1, xt2, xtime;
- int sp, tbefore, tafter;
- char command[200];
-
- if (argc == 1 || strcmp(argv[1], "/?") == 0 ) {
- printf("\tCHCS ╩╡╙├│╠╨≥ XTIME Version 1.00\n"
- "\tCopyright (c) │┬╜¡─■ 1993,1994.\n"
- "\n\t╦╡├≈: ▓Γ┴┐│╠╨≥╘╦╨╨╩▒╝Σ"
- "\n\t╙├╖¿: XTIME │╠╨≥├√ [▓╬╩² ...]"
- "\n\t╛┘└²: XTIME DIR\n"
- );
- exit(0);
- }
- strcpy(command, argv[1]); strcat(command, " ");
- sp = 2;
- while (*argv[sp]) {
- strcat(command, argv[sp]); strcat(command, " ");
- sp ++;
- }
- _AH = 0; asm int 0x1a;
- highBefore = _CX; lowBefore = _DX;
- GetTime(); tbefore = ((hour * 60) + min) * 60 + sec;
-
- system(command);
-
- GetTime(); tafter = ((hour * 60) + min) * 60 + sec;
- _AH = 0; asm int 0x1a;
- highAfter = _CX; lowAfter = _DX;
- t1 = ((unsigned long)highBefore << 16) + lowBefore;
- t2 = ((unsigned long)highAfter << 16) + lowAfter;
- i = t1 / 18.2; k = t2 / 18.2;
- xt1 = k - i; xt2 = tafter - tbefore;
- if (xt2 < xt1) xtime = xt1;
- else if ( (xt2 - xt1) < 1.0 ) xtime = xt1;
- else xtime = xt2;
- printf("\n\n│╠╨≥╘╦╨╨╩▒╝Σ: %8.3g ├δ\n", xtime);
- }
-