Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Diego Zamboni
RE: How to use mtime? [ reply ]  
2007-04-03 12:26
Hm... but demo.rb in CVS returns Time objects, and it seems to work fine...

Anyway, I tried using to_i, and I get the same result. Here is the mtime method in my script. For testing, I'm trying to do the same as demo.rb, set the mtime to "yesterday":

def mtime(path)
t=(Time.now-86400).to_i
puts "mtime(#{path})=#{t}, class=#{t.class}"
return t
end

With and without to_i I see the same result - files have the current time as timestamp. When I ls the directory I see the debug messages, the method is being called for each file and it is returning the correct time, but somehow it is not being used.

Thanks for any ideas.

By: Greg Millam
RE: How to use mtime? [ reply ]  
2007-04-02 23:32
How are you using it?

At the time, mtime() expects an integer result, and can't yet deal with Time objects. So Time.now() won't work, while Time.now.to_i will.

I aim to be able to support Time (or any objects with a to_i method) before I release the next version. Until then, try using to_i.

By: Diego Zamboni
How to use mtime? [ reply ]  
2007-04-02 11:04
Hi,

I noticed that in the CVS version of fusefs, there is support for specifying the m/a/ctime of a file by implementing the correspondingly-named method. This is in the new demo.rb, and it seems to work fine. However, when I try to do this in my own script, I can see that mtime is being called, but the directory listing displays the same times as it did in previous versions (the time at which the script was started). Is there something special I need to do? The main difference is that demo.rb uses MetaDir wheras I'm inheriting from FuseDir directly, but I couldn't see in the MetaDir code any special handling for this.

Thanks for any pointers!