last time a file was modified in milliseconds 
Author Message
 last time a file was modified in milliseconds

  Hi,

  I definitelly need to get the last time a file was modified in milliseconds. I am primarilly coding C++ code. The thing is that ANSI C++ does not give you that. Since I am calling C++ code from Java which i use as GUI, the options I have are:

 1._ Poking into the Java code and try to find out, how Java gets this value in the first place. (Java is written in C right?) I have gone:

 java.io.File.java -> java.io.FileSystem.java -> java.io.Win32FileSystem.class

 But how do you actually get to the piece of C code that implements that?

 My favorite way, even though I will have to take care of portability issues myself.

 2._ Calling the JVM from C++ and get this value from Java via the JNI. That I think will be way too slow, for my purpose. There will be too much object creation (a File object for each call to just make one method call) and I-O/marshalling, . . .

 3._ Setting up a Data Structure in CPP and save it to a file that can in turn be read in in Java and then go from there.

 Again, my favorite is the C/CPP only option, since it is the least messy one, even though it requires more code etc's.

 Are there any other options? How would you approach this prob?



Sat, 31 Jul 2004 06:18:55 GMT  
 last time a file was modified in milliseconds


Quote:

>  Hi,

>  I definitelly need to get the last time a file was modified in milliseconds.

You definnitely need to rethink your algorithm then!

Quote:
>I am primarilly coding C++ code. The thing is that ANSI C++ does not give you that.

Nor does ANSI C.

Quote:
>Since I am calling C++ code from Java which i use as GUI, the options I have are:

all offtopic. Unfortunately your question seems essentially to be "how
does Java get that info on platform X" so you'd have to ask the Java
specialists for your platform.

Also can you set your newsreader to wrap lines at 70 chars - your
message was illegible in the original format.

Quote:
> Are there any other options? How would you approach this prob?

I'd give up since few filesystems store the update time to the nearest
millisecond, and its bound to be inaccurate. Define "accessed" for
starters, and for writes do you mean "when a program in usermode last
wrote to it" or "when the OS cache last completed a lazy write" or
"when the HDD cache last completed a write-later"

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>



Sat, 31 Jul 2004 06:37:16 GMT  
 last time a file was modified in milliseconds

Quote:
> Are there any other options? How would you approach this prob?

Warily, and preferably with SWAT team surveillance.


Sat, 31 Jul 2004 09:13:51 GMT  
 last time a file was modified in milliseconds

Quote:

>   Hi,

>   I definitelly need to get the last time a file was modified in milliseconds. I am primarilly coding C++ code. The thing is that ANSI C++ does not give you that. Since I am calling C++ code from Java which i use as GUI, the options I have are:

... snip ...

>  Are there any other options? How would you approach this prob?

Gingerly, with your ten-foot pole.  All OT here.  Try groups with
C++ and/or Java in their names.

--

   Available for consulting/temporary embedded and systems.
   (Remove "XXXX" from reply address. yahoo works unmodified)



Sat, 31 Jul 2004 09:17:51 GMT  
 last time a file was modified in milliseconds

Quote:

>  Are there any other options? How would you approach this prob?

By reading the group FAQ, lurking, and then posting.  By doing this, I
would have determined that neither Java, C++, nor millisecond timing have
anything to do with ANSI C, which is the topic of this group.

Then, having determined that without embarassing myself by posting OT, I'd
do a Google ( http://www.google.com/ ) for the material I needed.  Failing
that, I'd try posting to the comp.lang.c++ newsgroup.

--
Duncan Bayne


     - Web    http://homepages.ihug.co.nz/~dhbayne/
     - Cell   (+64) (0)25 626 3023

  "The only difference between fascism and socialism is the
   degree of transparency of the methods of subjugation and
   degradation of the human spirit."

               -- Arthur Bayne



Sat, 31 Jul 2004 09:39:54 GMT  
 last time a file was modified in milliseconds

Quote:


> >  Are there any other options? How would you approach this prob?

> By reading the group FAQ, lurking, and then posting.  By doing this, I
> would have determined that neither Java, C++, nor millisecond timing have
> anything to do with ANSI C, which is the topic of this group.

> Then, having determined that without embarassing myself by posting OT, I'd
> do a Google ( http://www.google.com/ ) for the material I needed.  Failing
> that, I'd try posting to the comp.lang.c++ newsgroup.

I don't think clc++ would be too chuffed by that idea. ISO C++ has no
portable way to obtain the required information for the same reason that
ISO C doesn't.

--

"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton



Sun, 01 Aug 2004 21:57:13 GMT  
 last time a file was modified in milliseconds


Quote:
>  Hi,

>  I definitelly need to get the last time a file was modified in milliseconds.

Then you are likely to be disappointed becausethe filesystems on most OSs
don't record timestamps to anything liek that accuracy. You might
get a time to the nearest second if you are lucky, perhaps not even that
under Windows. :-)

Quote:
> I am primarilly coding C++ code. The thing is that ANSI C++ does not give you
> that.

No language can give you that if the underlying environment doesn't maintain
that information. As far as C is concerned it has no support at all for
file timestamps so the issue is moot.

Quote:
> Since I am calling C++ code from Java which i use as GUI, the options I
> have are:

> 1._ Poking into the Java code and try to find out, how Java gets this value in
> the first place. (Java is written in C right?) I have gone:

> java.io.File.java -> java.io.FileSystem.java -> java.io.Win32FileSystem.class

> But how do you actually get to the piece of C code that implements that?

If you want to fidn out if there is any Win32 magic to do this you should
ask in a Win32 related newsgroup such as comp.os.ms-windows.programmer.win32.
If Java managed to find the information under Windows that would be
ultimately where it got it from.

--
-----------------------------------------


-----------------------------------------



Thu, 05 Aug 2004 00:06:10 GMT  
 last time a file was modified in milliseconds

Quote:


>>  I definitelly need to get the last time a file was modified in
>>  milliseconds.

>Then you are likely to be disappointed becausethe filesystems on most OSs
>don't record timestamps to anything liek that accuracy. You might
>get a time to the nearest second if you are lucky, perhaps not even that
>under Windows. :-)

in the proper newsgroup the op might learn how to get ms level timestamps
for files stored on certain windows filesystems.

--
okay, have a sig then



Thu, 05 Aug 2004 15:37:16 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. last time a file was modified in milliseconds

2. last access time and last modified time for a folder

3. how can I get the file last modify time

4. use last modified time as filename of a file

5. POOM Item changes, last modified time

6. File last modification time

7. How to determine if a file's modified time is less than a week old

8. File accessed/modified time

9. Modified time for files

10. Last Modified

11. sleeping for time under the millisecond

12. How to convert local time to milliseconds?

 

 
Powered by phpBB® Forum Software