function IntToTime(Valeur:integer):string; var TmpVal:real; TmpStr:string; begin TmpVal := Valeur; TmpStr := ''; TmpVal := TmpVal / 3600000; TmpStr := inttostr(trunc(TmpVal)); TmpVal := (TmpVal-trunc(TmpVal))* 3600000; TmpVal := TmpVal / 60000; TmpStr := TmpStr + ':' + inttostr(trunc(TmpVal)); TmpVal := (TmpVal-trunc(TmpVal))*60000; TmpVal := TmpVal / 1000; TmpStr := TmpStr + ':' + inttostr(trunc(TmpVal)); TmpVal := (TmpVal-trunc(TmpVal))*1000; TmpVal := TmpVal; TmpStr := TmpStr + ':' + inttostr(trunc(TmpVal)); Result := TmpStr; end;
Salut. Que penses tu de ce code ? Function MilisecondesToTime( M : Integer) : String;Var T : TDateTime;Begin T:=D /86400000; Result := TimeToStr(T);End;// Exempleprocedure TForm1.Button1lick(Sender : TObject);Var T : Integer;begin T:=GetTickCount; Caption:= MilisecondesToTime(T);end;
Wé !!! c cool ton code !!!Mais comment fait-ton pour avoir les millisecondes ???Merci @+
Tu fais comme ça, pour avoir les milisecondes.Function MilisecondesToTime(D : Integer) : String;Var T : TDateTime; F : Double;Begin F := (Frac(D / 1000)) * 1000; T := D / 86400000; Result := TimeToStr(T) + ':' + IntTostr(Round(F));End; Au fait : http://philippe.gormand.free.fr/
ou comment se compliquer la vie :Il existe un type TTimeStamp:TTimeStamp =record Time:Integer; Date:Integer;end;donc le code :var T:TTimeStamp; D:TDateTime;begin T.time := 1254586; //millisecondes D:=TimestampToDateTime(T); ...et plein d'autre fonction ....end;en gros, vous reinventez la roue .... il faut lire la doc !!!!
Se souvenir du profil
Mot de passe oublié ? / Activation de compteCréer un compte
1 598 799 membres 65 nouveaux aujourd'hui 15 441 membres club