linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [QUESTION] file access time in millisecond?
@ 2007-02-12  7:27 Jeff Chua
  2007-02-12  8:01 ` Arjan van de Ven
  2007-02-12  9:02 ` Andi Kleen
  0 siblings, 2 replies; 9+ messages in thread
From: Jeff Chua @ 2007-02-12  7:27 UTC (permalink / raw)
  To: lkml

Is it possible to get file access time in millisecond resolution?

stat() returns time in seconds, but gettimeofday() can returns microseconds.


Thanks,
Jeff.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [QUESTION] file access time in millisecond?
  2007-02-12  7:27 [QUESTION] file access time in millisecond? Jeff Chua
@ 2007-02-12  8:01 ` Arjan van de Ven
  2007-02-12  9:24   ` Jeff Chua
  2007-02-12  9:02 ` Andi Kleen
  1 sibling, 1 reply; 9+ messages in thread
From: Arjan van de Ven @ 2007-02-12  8:01 UTC (permalink / raw)
  To: Jeff Chua; +Cc: lkml

On Mon, 2007-02-12 at 15:27 +0800, Jeff Chua wrote:
> Is it possible to get file access time in millisecond resolution?
> 
> stat() returns time in seconds, but gettimeofday() can returns microseconds.

see the "utimes()" function



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [QUESTION] file access time in millisecond?
  2007-02-12  7:27 [QUESTION] file access time in millisecond? Jeff Chua
  2007-02-12  8:01 ` Arjan van de Ven
@ 2007-02-12  9:02 ` Andi Kleen
  2007-02-12  9:52   ` Jeff Chua
  1 sibling, 1 reply; 9+ messages in thread
From: Andi Kleen @ 2007-02-12  9:02 UTC (permalink / raw)
  To: Jeff Chua; +Cc: lkml

"Jeff Chua" <jeff.chua.linux@gmail.com> writes:

> Is it possible to get file access time in millisecond resolution?
> 
> stat() returns time in seconds,

Not correct (at least for glibc stat). It supports nanoseconds these days,
although not all file systems (including ext3) do yet.

Some of the old stat compat emulations do not.

-Andi

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [QUESTION] file access time in millisecond?
  2007-02-12  8:01 ` Arjan van de Ven
@ 2007-02-12  9:24   ` Jeff Chua
  0 siblings, 0 replies; 9+ messages in thread
From: Jeff Chua @ 2007-02-12  9:24 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: lkml

On 2/12/07, Arjan van de Ven <arjan@infradead.org> wrote:

> see the "utimes()" function

Arjan,

I checked the man page, and it says ...

utime, utimes - change access and/or modification times of an inode

I just want to "read" the access time, and not changing it.

Thanks,

Jeff.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [QUESTION] file access time in millisecond?
  2007-02-12  9:02 ` Andi Kleen
@ 2007-02-12  9:52   ` Jeff Chua
  2007-02-12  9:56     ` Andi Kleen
  2007-02-12 10:01     ` Miquel van Smoorenburg
  0 siblings, 2 replies; 9+ messages in thread
From: Jeff Chua @ 2007-02-12  9:52 UTC (permalink / raw)
  To: Andi Kleen; +Cc: lkml

On 12 Feb 2007 10:02:28 +0100, Andi Kleen <ak@suse.de> wrote:

> > stat() returns time in seconds,
>
> Not correct (at least for glibc stat). It supports nanoseconds these days,
> although not all file systems (including ext3) do yet.

I'm using gcc-3.4.5, and glibc-2.3.6. Don't think 2.3.6 stat() support
that ... at least the man page doesn't indicate so.

Does that mean it's time to upgrade to glibc-2.5? or what's version
should I use?

I'm worry it'll break oracle, cups, mozilla or something else.

Thanks,
Jeff.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [QUESTION] file access time in millisecond?
  2007-02-12  9:52   ` Jeff Chua
@ 2007-02-12  9:56     ` Andi Kleen
  2007-02-12 18:55       ` Jeff Chua
  2007-02-12 10:01     ` Miquel van Smoorenburg
  1 sibling, 1 reply; 9+ messages in thread
From: Andi Kleen @ 2007-02-12  9:56 UTC (permalink / raw)
  To: Jeff Chua; +Cc: lkml

On Monday 12 February 2007 10:52, Jeff Chua wrote:
> On 12 Feb 2007 10:02:28 +0100, Andi Kleen <ak@suse.de> wrote:
> 
> > > stat() returns time in seconds,
> >
> > Not correct (at least for glibc stat). It supports nanoseconds these days,
> > although not all file systems (including ext3) do yet.
> 
> I'm using gcc-3.4.5, and glibc-2.3.6. Don't think 2.3.6 stat() support
> that ... 

It should be always available in padding, even on older glibc. Given a sufficiently
new kernel. The bigger problem is getting a file system that supports it.

> at least the man page doesn't indicate so. 

Manpages are often outdated.

-Andi

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [QUESTION] file access time in millisecond?
  2007-02-12  9:52   ` Jeff Chua
  2007-02-12  9:56     ` Andi Kleen
@ 2007-02-12 10:01     ` Miquel van Smoorenburg
  2007-02-12 18:58       ` Jeff Chua
  1 sibling, 1 reply; 9+ messages in thread
From: Miquel van Smoorenburg @ 2007-02-12 10:01 UTC (permalink / raw)
  To: linux-kernel

In article <b6a2187b0702120152s1279b931x813413a4234d8dec@mail.gmail.com>,
Jeff Chua <jeff.chua.linux@gmail.com> wrote:
>On 12 Feb 2007 10:02:28 +0100, Andi Kleen <ak@suse.de> wrote:
>
>> > stat() returns time in seconds,
>>
>> Not correct (at least for glibc stat). It supports nanoseconds these days,
>> although not all file systems (including ext3) do yet.
>
>I'm using gcc-3.4.5, and glibc-2.3.6. Don't think 2.3.6 stat() support
>that ... at least the man page doesn't indicate so.

Check out /usr/include/bits/stat.h

My glibc-2.3.2 (debian stable) has the nanoseconds stuff right there,
even though it isn't mentioned in the stat.2 manpage or the info pages.

Mike.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [QUESTION] file access time in millisecond?
  2007-02-12  9:56     ` Andi Kleen
@ 2007-02-12 18:55       ` Jeff Chua
  0 siblings, 0 replies; 9+ messages in thread
From: Jeff Chua @ 2007-02-12 18:55 UTC (permalink / raw)
  To: Andi Kleen; +Cc: lkml

On 2/12/07, Andi Kleen <ak@suse.de> wrote:

> It should be always available in padding, even on older glibc. Given a sufficiently
> new kernel. The bigger problem is getting a file system that supports it.
> Manpages are often outdated.

Andi,

Ok, found it. Thanks. You're right. ext2, reiserfs doesn't support it.
I was trying to get down to find out which file got generated first
and thought stat() would do the job, but didn't realize that it's not
so simply. Oh well.

Thanks,
Jeff.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [QUESTION] file access time in millisecond?
  2007-02-12 10:01     ` Miquel van Smoorenburg
@ 2007-02-12 18:58       ` Jeff Chua
  0 siblings, 0 replies; 9+ messages in thread
From: Jeff Chua @ 2007-02-12 18:58 UTC (permalink / raw)
  To: Miquel van Smoorenburg; +Cc: linux-kernel

On 12 Feb 2007 10:01:24 GMT, Miquel van Smoorenburg <miquels@cistron.nl>

> Check out /usr/include/bits/stat.h

Mike,

Thanks for the pointer. Got it. But as I mentioned to Andi, it doesn't
work with my filesystems (ext2, reiserfs). But at least it save me
from upgrading my glibc!


Thanks,
Jeff.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-02-12 18:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-12  7:27 [QUESTION] file access time in millisecond? Jeff Chua
2007-02-12  8:01 ` Arjan van de Ven
2007-02-12  9:24   ` Jeff Chua
2007-02-12  9:02 ` Andi Kleen
2007-02-12  9:52   ` Jeff Chua
2007-02-12  9:56     ` Andi Kleen
2007-02-12 18:55       ` Jeff Chua
2007-02-12 10:01     ` Miquel van Smoorenburg
2007-02-12 18:58       ` Jeff Chua

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).