Link to home
Create AccountLog in
Avatar of nickdelphi777
nickdelphi777

asked on

C++'s DateTime.Now.Ticks.ToString() Equivalent in delphi?

DateTime.Now.Ticks.ToString() in C++ what is the equivalent in delphi? The strings generated seem very different because I don't think GetTickCount() is the same.. thanks

string hash_id = Utilities.GetMd5Hash(DateTime.Now.Ticks.ToString());
hash_id = hash_id.Substring(0,8)  + "-" + hash_id.Substring(8, 4) + "-" + hash_id.Substring(12, 4) + "-" + hash_id.Substring(16, 4) + "-" + hash_id.Substring(20, 12);

Open in new window


my code:
function sessionhash:string;
var
h,b:string;
begin
h := lowercase(md5string(DateToStr(GetTickCount())));
b := copy(h,0,8)+'-'+copy(h,8,4)+'-'+copy(h,12,4)+'-'+copy(h,16,4)+'-'+copy(h,20,12);
result := b;
end;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of jimyX
jimyX

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Think that Environment.TickCount is equal to Delphi's GetTickCount (32 bit)
system.environment.tickcount