home *** CD-ROM | disk | FTP | other *** search
-
- (*
- * sysdate - library to return system date and time
- *
- * s.h.smith, 10-sep-86
- *
- *)
-
- function system_date: anystring; {format: yy/mm/dd}
- var
- reg: registers;
-
- function strval (i: integer): string2;
- begin
- strval := chr(((i div 10) mod 10) + ord('0')) +
- chr((i mod 10) + ord('0'));
- end;
-
- begin
- reg.ax := $2a00;
- msdos(reg);
- system_date := strval(reg.cx-1900) + '/' +
- strval(hi(reg.dx)) + '/' +
- strval(lo(reg.dx));
- end;
-
-
- function system_time: anystring; {format: hh:mm:ss}
- var
- reg: registers;
- hh,mm,ss: string[2];
-
- begin
- reg.ax := $2c00;
- msdos(reg);
- str(hi(reg.cx),hh); if length(hh) = 1 then hh := '0' + hh;
- str(lo(reg.cx),mm); if length(mm) = 1 then mm := '0' + mm;
- str(hi(reg.dx),ss); if length(ss) = 1 then ss := '0' + ss;
- system_time := hh + ':' + mm + ':' + ss;
- end;
-