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

Delphi

Avatar of undefined
Last Comment
Sinisa Vuk

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
jimyX

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Sinisa Vuk

Think that Environment.TickCount is equal to Delphi's GetTickCount (32 bit)
system.environment.tickcount
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy