Changeset 2 for trunk/linetime.lpr
- Timestamp:
- Jul 22, 2015, 4:28:36 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/linetime.lpr
r1 r2 22 22 StartTime: TDateTime; 23 23 NewLine: Boolean; 24 ShowTime: Boolean; 24 25 LastLineTime: TDateTime; 25 26 procedure PrintOutput(Output: string); … … 63 64 64 65 NewLine := True; 66 ShowTime := True; 65 67 FirstLine := True; 66 68 StartTime := Now; … … 91 93 LineTime: TDateTime; 92 94 begin 93 if (Length(Output) > 0) and NewLine then begin 95 if NewLine then begin 96 if FormatCSV then begin 97 if not FirstLine then WriteLn('"'); 98 end else begin 99 if not FirstLine then WriteLn(''); 100 end; 101 NewLine := False; 102 FirstLine := False; 103 end; 104 if (Length(Output) > 0) and ShowTime then begin 94 105 LineTime := Now - StartTime; 95 106 if FormatCSV then begin 96 if not FirstLine then WriteLn('"');97 107 Write(FloatToStrF(LineTime / OneSecond, ffFixed, 10, 2) + ',' + 98 108 FloatToStrF((LineTime - LastLineTime) / OneSecond, ffFixed, 10, 2) + ',"'); 99 109 end else begin 100 if not FirstLine then WriteLn('');101 110 Write(#$1b'[0;32m' + FloatToStrF(LineTime / OneSecond, ffFixed, 10, 2) + #$1b'[0m '); 102 111 end; 103 NewLine := False; 104 FirstLine := False; 112 ShowTime := False; 105 113 LastLineTime := LineTime; 106 114 end; … … 122 130 Delete(Buffer, 1, P + Length(LineEnding) - 1); 123 131 NewLine := True; 132 ShowTime := True; 124 133 end; 125 134 until P = 0;
Note:
See TracChangeset
for help on using the changeset viewer.