Click here to Skip to main content
13,400,775 members (35,621 online)
Rate this:
Please Sign up or sign in to vote.
See more:
This Picture shows all necessary data to understand the Problem:[^]

I have copy a File to another Client, using a networkdrive.
Than i have set the LastWriteTimeUtc to a defined value.
When i read the LastWriteTimeUtc of the written File (i used Refrech) there is always a glitch betwenn 1-2 Sek.
First i thought its connected with the local Time of each Client.
I tried to sync the local Time or set the local Time to a gread difference without any effect.
I also tried to find a cut in the binary precision but the digit which does not change lead to a precision of 40Sek. and not 1-2Sek. what says me its not connected to a precision.

I checked also the private Data of the FileInfo, and it is really not equal:
ftLastWriteTimeLow = 0xabdf4f00
ftLastWriteTimeLow = 0xaaf64ea1

I am at my wit's end.

Just if someone want to code a little bit (Traget&Source are getter which call .Refresh() on every Access):


Source.LastWriteTimeUtc = DateTime.UtcNow; 

Target.LastWriteTimeUtc = Source.LastWriteTimeUtc;
Target.CreationTimeUtc = Source.CreationTimeUtc;
var lLastWriteTimeUtc = ToBinary(Target.LastWriteTimeUtc.Ticks &  0xFFFFFFFF3000000);
var lLastWriteTimeUtc2 = ToBinary(Source.LastWriteTimeUtc.Ticks & 0xFFFFFFFF3000000);
var lLastWriteTimeUtc31 = ToBinary(Target.LastWriteTimeUtc.Ticks & 0xFFFFFFFF0000000);
var lLastWriteTimeUtc32 = ToBinary(Source.LastWriteTimeUtc.Ticks & 0xFFFFFFFF0000000);
var x = new DateTime(Source.LastWriteTimeUtc.Ticks & 0xFFFFFFFF0000000);
var y = new DateTime(Target.LastWriteTimeUtc.Ticks & 0xFFFFFFFF0000000);


//This is just the First hit when i looked for a ToBinary Converter, there is no need for improvement, i dont use it in regular code ;)
public static string ToBinary(Int64 Decimal)
    // Declare a few variables we're going to need
    Int64 BinaryHolder;
    char[] BinaryArray;
    string BinaryResult = "";

    while (Decimal > 0)
        BinaryHolder = Decimal % 2;
        BinaryResult += BinaryHolder;
        Decimal = Decimal / 2;

    // The algoritm gives us the binary number in reverse order (mirrored)
    // We store it in an array so that we can reverse it back to normal
    BinaryArray = BinaryResult.ToCharArray();
    BinaryResult = new string(BinaryArray);

    return BinaryResult;
Posted 13-Nov-12 8:10am
Christian Graus 13-Nov-12 13:13pm
Why does it matter ?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I changed the Client and the Problem disappeared.

@Christian Graus:
Its a part of a fast HashValue generation, to detect File changes in a Network Environment.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180218.2 | Last Updated 16 Nov 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100