Bläddra i källkod

Quick.Chrono fpc sample

Unknown 6 år sedan
förälder
incheckning
a6c3dbefea
2 ändrade filer med 96 tillägg och 0 borttagningar
  1. 64 0
      samples/fpc/QuickChrono/simplechrono.lpi
  2. 32 0
      samples/fpc/QuickChrono/simplechrono.lpr

+ 64 - 0
samples/fpc/QuickChrono/simplechrono.lpi

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<CONFIG>
+  <ProjectOptions>
+    <Version Value="11"/>
+    <PathDelim Value="\"/>
+    <General>
+      <Flags>
+        <MainUnitHasCreateFormStatements Value="False"/>
+        <MainUnitHasTitleStatement Value="False"/>
+        <MainUnitHasScaledStatement Value="False"/>
+      </Flags>
+      <SessionStorage Value="InProjectDir"/>
+      <MainUnit Value="0"/>
+      <Title Value="simplechrono"/>
+      <UseAppBundle Value="False"/>
+      <ResourceType Value="res"/>
+    </General>
+    <BuildModes Count="1">
+      <Item1 Name="Default" Default="True"/>
+    </BuildModes>
+    <PublishOptions>
+      <Version Value="2"/>
+    </PublishOptions>
+    <RunParams>
+      <FormatVersion Value="2"/>
+      <Modes Count="0"/>
+    </RunParams>
+    <Units Count="1">
+      <Unit0>
+        <Filename Value="simplechrono.lpr"/>
+        <IsPartOfProject Value="True"/>
+      </Unit0>
+    </Units>
+  </ProjectOptions>
+  <CompilerOptions>
+    <Version Value="11"/>
+    <PathDelim Value="\"/>
+    <Target>
+      <Filename Value="simplechrono"/>
+    </Target>
+    <SearchPaths>
+      <IncludeFiles Value="$(ProjOutDir)"/>
+      <OtherUnitFiles Value="..\..\.."/>
+      <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
+    </SearchPaths>
+    <CodeGeneration>
+      <TargetCPU Value="x86_64"/>
+      <TargetOS Value="linux"/>
+    </CodeGeneration>
+  </CompilerOptions>
+  <Debugging>
+    <Exceptions Count="3">
+      <Item1>
+        <Name Value="EAbort"/>
+      </Item1>
+      <Item2>
+        <Name Value="ECodetoolError"/>
+      </Item2>
+      <Item3>
+        <Name Value="EFOpenError"/>
+      </Item3>
+    </Exceptions>
+  </Debugging>
+</CONFIG>

+ 32 - 0
samples/fpc/QuickChrono/simplechrono.lpr

@@ -0,0 +1,32 @@
+program simplechrono;
+
+uses
+  SysUtils,
+  DateUtils,
+  Quick.Commons,
+  Quick.Console,
+  Quick.Chrono;
+
+var
+  crono : TChronometer;
+  starttime : TDateTime;
+  ms : Int64;
+begin
+  try
+    Console.LogVerbose := LOG_ALL;
+    cout('Chrono Test',etInfo);
+    crono := TChronometer.Create;
+    crono.Start;
+    starttime := Now();
+    repeat
+      ms := MillisecondsBetween(Now(),StartTime);
+    until ms >= 4000;
+    crono.Stop;
+    cout('crono stopped!',etInfo);
+    cout('Loop: %d Elapsed: %s',[ms,crono.ElapsedTime],etInfo);
+    Readln;
+  except
+    on e : Exception do WriteLn(e.message);
+  end;
+end.
+