J
Joseph Geretz
The code statements below are from the .NET framework using C#. However the
question I'm asking is not specific to this environment. I'm asking for help
in understanding file timestamps which are characteristic of the underlying
filesystem.
I'm getting all confused with the various types of filetimes; local and UTC
if I understand that much correctly.
FileInfo FI = new FileInfo(FileSpec);
According to my understanding, I would expect
FI.LastWriteTime.ToFileTimeUtc();
to be equal to
FI.LastWriteTimeUtc.ToFileTime();
According to my (mistaken) understanding, the first gets the local LastWrite
time and then converts it to a UTC FileTime. The second one gets the Last
write time in UTC and then simply converts it to a FileTime. So why do these
come out different?
These two I understand:
FI.LastWriteTime
FI.LastWriteTimeUtc
But these four, which use various combinations of local & UTC conversion are
a mystery to me. Since LastWriteTime can be retrieved as either
LastWriteTimeor UtcLastWriteTimeUtc Why do we need a ToFileTimeUtc at all?
FI.LastWriteTime.ToFileTime
FI.LastWriteTime.ToFileTimeUtc
FI.LastWriteTimeUtc.ToFileTime
FI.LastWriteTimeUtc.ToFileTimeUtc
Are therse two simply invalid?
FI.LastWriteTime.ToFileTimeUtc
FI.LastWriteTimeUtc.ToFileTime
Does it mean anything to pair local and Utc methods together in this manner,
or is this simply illogical?
Specifically, I need to compare the times for two files on separate servers.
I'm pulling my information via Web Services and the two servers may be in
different time zones. How can I get the last write timestamp from both files
in a unified format so that I can see which file was written to more
recently?
Thanks for your help!
- Joe Geretz -
question I'm asking is not specific to this environment. I'm asking for help
in understanding file timestamps which are characteristic of the underlying
filesystem.
I'm getting all confused with the various types of filetimes; local and UTC
if I understand that much correctly.
FileInfo FI = new FileInfo(FileSpec);
According to my understanding, I would expect
FI.LastWriteTime.ToFileTimeUtc();
to be equal to
FI.LastWriteTimeUtc.ToFileTime();
According to my (mistaken) understanding, the first gets the local LastWrite
time and then converts it to a UTC FileTime. The second one gets the Last
write time in UTC and then simply converts it to a FileTime. So why do these
come out different?
These two I understand:
FI.LastWriteTime
FI.LastWriteTimeUtc
But these four, which use various combinations of local & UTC conversion are
a mystery to me. Since LastWriteTime can be retrieved as either
LastWriteTimeor UtcLastWriteTimeUtc Why do we need a ToFileTimeUtc at all?
FI.LastWriteTime.ToFileTime
FI.LastWriteTime.ToFileTimeUtc
FI.LastWriteTimeUtc.ToFileTime
FI.LastWriteTimeUtc.ToFileTimeUtc
Are therse two simply invalid?
FI.LastWriteTime.ToFileTimeUtc
FI.LastWriteTimeUtc.ToFileTime
Does it mean anything to pair local and Utc methods together in this manner,
or is this simply illogical?
Specifically, I need to compare the times for two files on separate servers.
I'm pulling my information via Web Services and the two servers may be in
different time zones. How can I get the last write timestamp from both files
in a unified format so that I can see which file was written to more
recently?
Thanks for your help!
- Joe Geretz -