Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UTC time without
Message
 
To
05/03/2004 14:23:23
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00883625
Message ID:
00883634
Views:
8
>First, Geo, I wouldn't try to spoil your sacred Friday, but I'm doing something very weird, and spanning timezones.
>
>I'm using your WindowsTime stuff, and I've plugged it quite easily to do what I need it to. The trouble is that this thing is supposed to be running through Citrix, and using Local times would just create chaos - I need the files I copy to the server to have the exact server time (not UTC - though I know it's UTC internally). Most methods of copying actually preserve the time quite fine, but StrToFile() has the advantage of being able to copy files opened elsewhere (even foxuser.*) - but it sets the timestamp of the copy to current moment. Thus, I wanted to timestamp the copy same as the original. Original is on the same server (and, surprisingly though, in the same timezone).
>
>So in the FileTime.prg, I have commented the line
>lcresult = This.oConvert.LocalToFileTime(lcresult)
>because it was giving me the time converted to EST (my local zone), so now I'm getting the time I should be getting... well, almost. It's one hour ahead from what I got from the wsh.filesystem file object.
>
>The server is at GMT +1. So
>
lcresult = This.oConvert.SystemToFileTime(pdtdatetime)
>is probably expecting... and when I set that time to be the file's time, in any directory listing it appears to be one hour ahead. (Ahead of what? It depends what's showing me the time - some tools show me CET, some show me EST - all converted from UTC, it just depends whether they take the timezone from the server or from the citrix client box).
>
>Now do you have any idea how to force the SetFilesTime to accept the parameter as CET? MAybe I should just convert the desired time to localtime first? Ummm.

Dragan,

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.

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.

What's displayed in the Explorer, provided the time zone is set correctly, is based on the current bias. IOW, files created under daylight savings time will display the standard time when viewed during EST and vice-versa.

Does any of this help?
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform