1. Interesting question: timestamping

Here's a question that just came to my mind; it's for an idea I have (if
it's impossible, I won't even bother trying to finish the application.)

Is it possible in Euphoria to timestamp a file in such a way that you can
verify that the user is accessing the original file and not a copy?

This is an example of what I'd like to do:
   - create a new file
   - get the creation and/or modification date & time of the newly created
      file
   - store that pertinent data within the file itself
   - close the file

And I would need to do it in such a way that if the file is copied, resulting
in a different creation/modification date-time for the copied file, a program
will notice when it reads it and compares the internal data with the
DOS/Windows date-time.

I tried writing a little experimental program to see if it's possible, but I'm
getting mixed results; usually the timestamp turns out okay (so that a
read recognizes it as the original file), but I've also had it not recognize the
file as original. And when copied, the newer file *also* is recognized as
the original--I'm guessing that Eu's dir() function returns the last-modified
date-time?

So what do you all think? Does this even sound possible, assuming the file
creation and dir() call are executed in immediate succession? Or is there
too much potential for mismatch? I had made some assumptions about the
way Windows and DOS alter last-modified and creation dates for a file when
it is copied, (or newly created, or overwritten) but now I'm not sure how valid
those assumptions are. I thought I'd toss this out as an intellectual exercise,
because right now my brain is starting to hurt just from thinking about it...

Rod Jackson

P.S. If not Euphoria, is there a way to do it in another language (without
resorting to some technique such as a direct write to the directory sectors?)

new topic     » topic index » view message » categorize

2. Re: Interesting question: timestamping

Message text written by Roderick Jackson:
>Is it possible in Euphoria to timestamp a file in such a way that you ca=
n
verify that the user is accessing the original file and not a copy?<

If you copy a file, the copied file should have the same date and time as=

the original file.  But, if you modify a file, the time and date will
change.

Why don't you set the date/time of the file to a predetermined value.  Th=
at
way you will be sure of a match, and you can do tricks such as setting th=
e
time equal to the version number of the file.

Colin Taylor

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu