FIle Date/Time

I’m not sure if this is supposed to be supported in this version or not, but every time I write a file its timestamp reflects june of last year. My Hydra’s clock is being automatically set by my PC over bluetooth so it is correct. I’m using Utlity.SetLocalTime Am I doing something wrong here?

Can you post a sample of how you are implementing this function for us to test?

It’s pretty simple, just set the Date/Time and save a file.


                case "TIME":
                    Utility.SetLocalTime(new DateTime(int.Parse(val.Substring(0, 4)), int.Parse(val.Substring(4, 2)), int.Parse(val.Substring(6, 2)),
                        int.Parse(val.Substring(8, 2)), int.Parse(val.Substring(10, 2)), int.Parse(val.Substring(12))));
                    break;

                        FileStream fs = new FileStream(_file, FileMode.Create);
                        byte[] b;
                        int read;

                        while (_fileSize > 0)
                        {
                            if (_serial.BytesToRead > 0)
                            {
                                b = new byte[_serial.BytesToRead];
                                read = _serial.Read(b, 0, b.Length);
                                if (read <= _fileSize)
                                {
                                    fs.Write(b, 0, b.Length);
                                    _fileSize -= read;
                                }
                                else
                                {
                                    fs.Write(b, 0, (int)_fileSize);
                                    _fileSize = 0;

                                    byte[] b2 = new byte[b.Length - (int)_fileSize];
                                    Array.Copy(b, (int)_fileSize, b2, 0, b2.Length);
                                    _buffer += new string(UTF8Encoding.UTF8.GetChars(b2));
                                }

                                w.Value += read;
                            }
                        }

            fs.Close();
            VolumeInfo[] vi = VolumeInfo.GetVolumes();
            if (vi == null || vi.Length == 0)
                return;
            for (int i = 0; i < vi.Length; i++)
                vi[i].FlushAll();

Try to put a static date and time in the fields to test the function. I used this line right before creating a simple text file:

Utility.SetLocalTime(new DateTime(2012, 8, 30, 13, 48, 0)); 

and removed the card from Hydra and verified on the PC that what was in the Hydra program was the same on the PC, so perhaps the variables that you are using are not correct? Perhaps do a

Debug.Print

on the variables that you are using to make sure they are printing what is expected.

I’ll check tonight and get back to you.