Get last write time bug!

  • Thread starter Thread starter Vladimir
  • Start date Start date
V

Vladimir

I have the file "439.Jpg" with last write time 25.10.98 03:06:06.
But FIleInfo LastWriteTime instance member returns 25.10.98 02:06:06!

And File GetLastWriteTime static member returns the same.

And may be with directories and creation (and etc) times is the same...

..Net framework v1.1, Windows xp {Service pack 2}.
 
Vladimir said:
I have the file "439.Jpg" with last write time 25.10.98 03:06:06.
But FIleInfo LastWriteTime instance member returns 25.10.98 02:06:06!

And File GetLastWriteTime static member returns the same.

And may be with directories and creation (and etc) times is the same...

.Net framework v1.1, Windows xp {Service pack 2}.

Well, how are you seeing both of those times? Is one perhaps displayed
in local time and one in UTC?
 
I have the file "439.Jpg" with last write time 25.10.98 03:06:06.
Well, how are you seeing both of those times? Is one perhaps displayed
in local time and one in UTC?

/*
DateTime time;

// Last write time for this file is 25.10.98 03:06:06
// because of windows saying this.
time = File.GetLastWriteTime("E:\\Operable\\Rules.Ion");

File.SetLastWriteTime("E:\\Operable\\Rules.Ion", time);
// But now last write time for this file is 25.10.98 02:06:06.
*/

Can it be normal?

If yes, then why...

/*
DateTime time;

// Last write time for this file is 25.10.98 02:06:06
time = File.GetLastWriteTime("E:\\Operable\\Rules.Ion");

File.SetLastWriteTime("E:\\Operable\\Rules.Ion", time);
// Why now last write time for this file is not equals 25.10.98 01:06:06???
*/
 
Vladimir said:
/*
DateTime time;

// Last write time for this file is 25.10.98 03:06:06
// because of windows saying this.
time = File.GetLastWriteTime("E:\\Operable\\Rules.Ion");

File.SetLastWriteTime("E:\\Operable\\Rules.Ion", time);
// But now last write time for this file is 25.10.98 02:06:06.
*/

If calling SetLastWriteTime with the value returned by GetLastWriteTime
changes the value, that defeinitely seems odd.

Have you tried using the UTC versions? (File.SetLastWriteTimeUtc etc)
 
/*
If calling SetLastWriteTime with the value returned by GetLastWriteTime
changes the value, that defeinitely seems odd.

Yes, and it depends entirely on time value.

22.10.98 03:06:06 transformed to 22.10.98 02:06:06 (bug)
but for example
23.10.98 03:06:06 is not transformed to 23.10.98 02:06:06 (not bug)

How about this in .Net Framework 2.0?
I don't have it beta version.
Have you tried using the UTC versions? (File.SetLastWriteTimeUtc etc)

In case of said above times that's all right with utc versions.
 
Vladimir said:
Yes, and it depends entirely on time value.

22.10.98 03:06:06 transformed to 22.10.98 02:06:06 (bug)
but for example
23.10.98 03:06:06 is not transformed to 23.10.98 02:06:06 (not bug)

Out of interest, is that the date that daylight saving time changes in
your locale?
How about this in .Net Framework 2.0?
I don't have it beta version.

Me either, I'm afraid.
In case of said above times that's all right with utc versions.

Right - I'd suggest using the UTC versions then. In fact, I think
that's a better bet usually anyway :)
 
Out of interest, is that the date that daylight saving time changes in
your locale?

Hem, i'am not sure exactly what about you speaking...
But my time zone is "Gmt +02:00".
 
Back
Top