lfrodrigues
asked on
how to convert UNIX time to DOS time
I need to convert a unix time to dos. I do i do this?
The code must support when february is 29 days long and make the write ajustements.
So any ideas?...
Thanks
LR
The code must support when february is 29 days long and make the write ajustements.
So any ideas?...
Thanks
LR
ASKER
I've post a deletion request on the other question. Thanks
ASKER
I've tested that source and it works iven if february is 29 days. How do i reverse the process??
Yor source is pretty good but i have has some problems implementing it, since my final componet might be compiled with delphi 1 or 2 and they don't have int64. I would also preffer to use a function with has the source instead of using FileTimeToSystemTime.
Yor source is pretty good but i have has some problems implementing it, since my final componet might be compiled with delphi 1 or 2 and they don't have int64. I would also preffer to use a function with has the source instead of using FileTimeToSystemTime.
Well, to reverse the calculation simply reverse the steps I gave you in the routine above. Is this so hard to do it yourself or do you expect that I give you every single code line ready to build in into your program?
Concerning Delphi 1/2 compatibility: Unfortunately, I can neither write nor test code for these versions as I don't have them. That's stuff you need to do yourself. And what do you mean with: "I would also preffer to use a function with has the source instead of using FileTimeToSystemTime." I have not understood this sentence.
Ciao, Mike
Concerning Delphi 1/2 compatibility: Unfortunately, I can neither write nor test code for these versions as I don't have them. That's stuff you need to do yourself. And what do you mean with: "I would also preffer to use a function with has the source instead of using FileTimeToSystemTime." I have not understood this sentence.
Ciao, Mike
ASKER
I would like to use use source insstead of using the windows funtion: FileTimeToSystemTime
Please, what source? What should that be? Can you please be a bit more specific?
ASKER
the source of FileTimeToSystemTime
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
it works so thanks
C grading, mmh?
ASKER
ups it was supost be b sorry...
The solution for your problem is:
function UnixTimeToDateTime(const UnixTime: Integer): TDateTime;
var
FileTime: TFileTime;
SystemTime: TSystemTime;
I: Int64;
begin
// first convert unix time to a Win32 file time
I := Int64(UnixTime) * Int64(10000000) + 116444736000000000;
FileTime.dwLowDateTime := DWORD(I);
FileTime.dwHighDateTime := I shr 32;
// now convert to system time
FileTimeToSystemTime(FileT
// and finally convert the system time to TDateTime
Result := SystemTimeToDateTime(Syste
end;
I must admit, I never checked it for the 29. February issue, so this needs to be verified. Therefor I post this as comment only.
Ciao, Mike