File Date and Time stamp after FileStream.Write(), C#

N

Neville Lang

Hi all,

I have just noticed in my CF app on a Pocket PC (PPC) that when I create a
new file and write some bytes to it on the PPC using FileStream's
FileMode.CreateNew (and Create), FileAccess.Write, the date and time stamp
displayed in the Modified column in Windows Explorer on the desktop,
accessing the Mobile Device, suggests that the Modified time is set for UT
and not my local time. I have just noticed this and so do not know whether
it has occurred in the past.

I automatically thought that the date and time stamp would use the PPC's
current date and time (I seem to remember that it did so in the past) but
evidently not.

Any ideas?

My app is currently using CFv1 on VS2005. I will be changing it to CFv2
soon.


Regards,
Neville Lang
 
G

Guest

The time stamp is handled by the OS's File System Driver, so the CF has
nothing to do with how it gets stamped.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
 
N

Neville Lang

Hi Chris,

Thank you for that information. Does that mean that whenever a new file is
created, it always get stamped with the UT time stamp? I felt sure that
newly created files had the time stamp of the local time.

If a new file always gets stamped with UT time, what do I need to do in CF
(or P/Invoke) to change the time to local time when new files are created?

Sorry for these questions but something must have changed recently. I do not
remember having this problem before. This app has been around for over 3
years and I feel sure time stamps were OK previously.

Regards,
Neville Lang



9848 2678
 
P

Paul G. Tobey [eMVP]

It means that what time gets put on the file depends on what filesystem the
file is being stored to. It might be different on a storage card and in the
object store, for example. I seem to remember some traffic about this in a
thread in another group. You might use GoogleGroups advanced groups search
to search all of microsoft.public.windowsce.* for something about file time
stamps being UTC or not...

Paul T.
 
N

Neville Lang

Hi Paul,

Thanks for the information. I found the thread that you mentioned.

One thing that has changed on my setup is that up to now, I have been
running app tests on my Dell Axim Pocket PC device, with the app installed
in the device memory. I have recently been testing my app on my Pocket PC
phone device where the app has been installed onto a memory card.

It has been the memory card installation that has been the change and is
where I noticed the time stamp differences. From the information on the
other thread, it just might be that creating a new file on a memory card
uses UT time by that particular file store driver but doing the same thing
in device memory uses local time.

If we have to depend on memory card drivers for time stamps then it might
very well be that some memory card file store drivers use UT time while
others use local time. I have not tested this out yet but if this is the
case then what an inconsistency!

Fortunately, the time stamp issue is not critical for my application but
something that I just noticed. I do not know how other apps might cope if
they were time stamp dependent and were deployed to consumers that where
there are different types of memory cards.

Regards,
Neville Lang




"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:eaD$B%[email protected]...
 
G

Guest

Fortunately, the time stamp issue is not critical for my application but
something that I just noticed. I do not know how other apps might cope if
they were time stamp dependent and were deployed to consumers that where
there are different types of memory cards.

If you were time-stamp dependent then you'd test for it. Write a "test"
file at startup or install and then read back that file's properties to see
what its time stamp is, then save the necessary "adjustment" somewhere for
use later when you're saving actual data.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com
 
P

Paul G. Tobey [eMVP]

Or put the time stamp *in* the file data. You are then in control over what
is stored and can do whatever you want about it later...

Paul T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top