Here is the file time to local time function from Auto3Lib (A3LWinAPI.au3). There are some more time functions there too if your interested.

; =================================================================================================; Description ..: Converts a file time based on the Coordinated Universal Time to a local file time; Parameters ...: $rFileTime - FILETIME structure containing the UTC-based file time to convert; into a local file time.; Return values : FILETIME structure that contains the converted local file time; =================================================================================================Func_FileTimeToLocalFileTime($rFileTime)Local$pFileTime,$pLocalTime,$rLocalTime,$aResult$rLocalTime=DllStructCreate($FILETIME)$pLocalTime=DllStructGetPtr($rLocalTime)$pFileTime=DllStructGetPtr($rFileTime)$aResult=DllCall("Kernel32.dll","int","FileTimeToLocalFileTime","ptr",$pFileTime,_"ptr",$pLocalTime)Return$rLocalTimeEndFunc

Link to post

Share on other sites

martin 66

martin 66

FileGetTime is for windows so to use it I would need to download the file and then find its timestamp. But I am trying to get the timestamp of a file using ftp, (InternetFindNextFile), without having to download it, so I end up with a FileTime struct. But maybe there is a better way.

Share this post

Link to post

Share on other sites

PaulIA 1

PaulIA 1

My vote goes to the Underscore infront of the internal Dll functions...

He's using some of the overloaded Auto3Lib functions (which are being removed in the next release). They just call the AutoIt function and do some automated error checking. The help file has this to say about DllStructPtr errors:

@Error:
0 = No Error.
1 = Struct not a correct struct returned by DllStructCreate.
2 = Element is out of bounds.

The date is always 1/1/1601 and the time varies, ( and I'm fairly sure the files aren't that old.)

1/1/1601 means the date value is always zero so I'm lost again.

Is it possible that the server doen't use UTC format? It's a UNIX system. I'll check this

_FileTimeToLocalFileTime converts a file time to a local time and _FileTimeToSystemTime converts a file time to a system time. I don't think you want to call one with the results of the other. To test, just call _FileTimeToLocalFileTime and display the results. Then do the same with _FileTimeToSystemTime. I'm betting one of them will get you what you want.

Share this post

Link to post

Share on other sites

martin 66

martin 66

_FileTimeToLocalFileTime converts a file time to a local time and _FileTimeToSystemTime converts a file time to a system time. I don't think you want to call one with the results of the other. To test, just call _FileTimeToLocalFileTime and display the results. Then do the same with _FileTimeToSystemTime. I'm betting one of them will get you what you want.

Not a good bet!

_FileTimeToLocalFileTime returns a FILETIME struct so I can' use that, and I think I'm correct to use its output in the _FileTimeToSystemTime function. Anyway, if I try as below then the result is exactly the same.

So the definition in the FTP function is not correct. That's probably causing the problem when you try to assign a 64 bit value to a structure with two 32 bit integers. Try changing the FTP function struct to 2 int values for each int64 value and see what you get.

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

I apologize if I am being totally stupid, but I would like to use this code, but you state that I must fist create a Filetime Dll Structure- which I am not sure how to do. Here's the situation: I have some filetime data that I am receiving in an XML document and I would like to convert it to user readable MM/DD/YYYY HH:MM:SS format.

Here is an example of the data I receive:

<CREATIONTIME>

<HIGHPART>0x01C6FE83</HIGHPART>

<LOWPART>0x92D51928</LOWPART>

</CREATIONTIME>

<LASTMODIFICATIONTIME>

<HIGHPART>0x01C6FE97</HIGHPART>

<LOWPART>0x395C54EA</LOWPART>

</LASTMODIFICATIONTIME>

I have been doing a lot of reading on this forum, MSDN, Google searches, etc. and I am somehow just not seeing the answer. Could someone do a little hand-holding for me and lead me to the answer without flaming me for being a dumbass?

Share this post

Link to post

Share on other sites

PaulIA 1

PaulIA 1

Thank you so much, I have taken the time to test this out and it works like a charm. Auto3Lib is quite impressive. I'm still trying to wrap my brain around many of the functions, but it's ingenious.

Glad I could help. If you get stuck trying to figure out a specific Auto3Lib function, feel free to drop a line in the Auto3Lib thread and I'll be glad to help you out. I'm also working on an AutoIt style help file that should be out in the next few weeks.