home *** CD-ROM | disk | FTP | other *** search
- Program Stamp;
-
- {
- By Timothy B. Coleman. Rather than using Turbo Pascal Ver. 4 Date and time
- Procedures, I have called MSDOS Int 21H date and time. Notice this source
- is larger than the source for DT.PAS, which uses Turbo Pascal Ver. 4 Date
- and Time functions to accomplish the same thing. The .EXE file produced is
- slightly smaller that the version produced with TP4 functions.
- }
-
- Uses DOS;
-
- Var
- ThisDate : String[15];
- Time : String[15];
- Regs : Registers;
-
- PROCEDURE GetDate;
-
- Type
- String9 = String[9];
-
- Const
- MonthNames : array [1..12] of String9 =
- ('January','February','March','April','May','June',
- 'July','August','September','October','November','December');
-
- VAR
- Year,Month,Day : Integer;
- Temp1, DateString, Temp2 : String[16];
- Begin
- regs.ax := $2a00;
- msdos(regs);
- Year := regs.cx;
- Month := hi(regs.dx);
- Day := lo(regs.dx);
- Str(Year,Temp1);
- DateString := MonthNames[Month];
- Str(Day,Temp2);
- DateString := DateString + ' ' + Temp2 + ', ' + Temp1;
- ThisDate := Datestring;
- end;
-
- Procedure GetTime;
-
- Var
- TimeString : String[16];
- TempTime : String[5];
- Hours, Minutes, Seconds : Integer;
-
- Begin
- regs.ax := $2C00;
- MsDos(regs);
- Hours := hi(regs.cx);
- Str(Hours,TempTime);
- If length(TempTime) = 1 Then TempTime := '0' + TempTime;
- TimeString := TempTime + ':';
- Minutes := lo(regs.cx);
- Str(Minutes,TempTime);
- If length(TempTime) = 1 Then TempTime := '0' + TempTime;
- TimeString := TimeString + TempTime + ':';
- Seconds := hi(regs.dx);
- Str(Seconds,TempTime);
- If length(TempTime) = 1 Then TempTime := '0' + TempTime;
- TimeString := Timestring + Temptime;
- Time := TimeString;
- end; { GetTime }
-
- Begin {main}
- GetDate;
- GetTime;
- Writeln('Date and Time: ',ThisDate,' ',Time); {No Direct video so
- redirectable to a file or printer, serial or par.}
-
- end.