Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UTC time without
Message
From
05/03/2004 15:23:45
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00883625
Message ID:
00883651
Views:
10
>This last part sounds right. If you look at the code in GetFilesTime(), you'll notice calls to ConvertFileTime(). In that function, you'll see the following.
ldtresult = This.oConvert.FileToLocalTime(pcfiletile)
>ldtresult = This.oConvert.FileTimeToSystem(ldtresult)
>ldtresult = This.oConvert.SystemToDateTime(ldtresult)
What's retrieved in GetFilesTime() is UTC time. You'll note that there's no conversion calls in SetFilesTime(). This is because Windows handles it internally.

And this is what hurts me. If I leave it as is, the above three lines cause the filetime to go to 01/01/1985 06:00:00.

>If I wanted to set a file's time to show UTC plus 1 that's what I would pass it. However, if I wanted the actual timestamp to be UTC plus one, from Eastern Time, I'd simply add an hour.

Actually, I had to take one hour off, because I'm storing the CentralEuropean times, and this call requires UTC.

I think I've finally got it - by commenting the .SystemToDateTime call in ConvertFileTime AND commenting .LocalToDateTime in ConvertDateTime. Somehow these two cancel each other out and I'm getting the files with correct times and dates. Gee, even centuries are correct :).

In the end, I'll have a stick-and-rope (I think it would be called "tin foil and chewing gum" in American terms) version control. It should be able to keep stuff in sync no matter which continent the programmer calls from, by keeping every timestamp tied to server's timezone.

If ever we move the server, there'll be just one setting to change in the ini file :).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform