Re: utime() vs. utimes()
- From: Henry Townsend <henry.townsend@xxxxxxxx>
- Date: Wed, 25 Oct 2006 13:52:38 -0400
Daniel Rock wrote:
Henry Townsend <henry.townsend@xxxxxxxx> wrote:My code is "portable" in the sense that it's been ported to a number of platforms. I get nanosecond mtime resolution on Solaris, for instance, by peeking into the stat struct. This is clearly not portable but it's protected by ifdef.
No, with UFS you will only get usec resolution.
You're being deliberately argumentative - did you get up on the wrong side of bed today? The Solaris stat structure stores nanosecond resolution; it doesn't matter what the underlying FS can do as long as it's not finer-grained than nanosecond. This just means all the timestamps read out of the stat structure for UFS files will end with three zeroes.
In other words _Solaris_ can handle nanoseconds - it's _UFS_ that provides the usec limitation. I did say that the point was to get the best data available, which is unaffected by the UFS sidetrack.
The best example of a program which "must have" the same info as the filesystem is 'make'. My program is not make but behaves similarly in this way.
Make is quite happy with only seconds resolution. For any granularity there
will be a time interval which will compare as equal. The standard defined
a second should be sufficient.
Make may be happy but it can happily do the wrong thing, thus making the developer unhappy. This stuff is old and has been hashed out before. Don't believe me? Check out GNU make's .LOW_RESOLUTION_TIME feature and rationale.
If you cannot live with that, then program unportable.
Oh, I'm sorry, I must have stumbled into comp.lang.portable-only by mistake! I meant to be in comp.unix.programmer where portability issues are discussed as a fact of life.
HT
.
- References:
- utime() vs. utimes()
- From: phil-news-nospam
- Re: utime() vs. utimes()
- From: Daniel Rock
- Re: utime() vs. utimes()
- From: Henry Townsend
- Re: utime() vs. utimes()
- From: Daniel Rock
- Re: utime() vs. utimes()
- From: Henry Townsend
- Re: utime() vs. utimes()
- From: Daniel Rock
- utime() vs. utimes()
- Prev by Date: Re: utime() vs. utimes()
- Next by Date: Re: using pipe
- Previous by thread: Re: utime() vs. utimes()
- Next by thread: Re: utime() vs. utimes()
- Index(es):
Relevant Pages
|