08-29-04 12:48 PM
In article <KWHVc.59508$TI1.46402@attbi_s52>,
Mohun Biswas <m.biswas@invalid.addr> writes:
[...]
> For the 'get' part, it looks like there's no standard API. Looks like a
> bunch of ugly ifdefs are required. Does anyone have a sample piece of
> code that handles the major platforms or just shows the way?
That requires looking at the include files on a bunch of platforms.
It's interesting that there's an almost irrelevant reference to the
possibility that the timespec structure may be defined as in <times.h> in
the SUSv3 stat() page. That suggests that e.g. something like what Sun
does is permitted but not required. The absence of any way to tell being
described suggests that there's no standard way to tell, meaning that
anything you come up with won't be standards-based, but will at best
work for now on the platforms you target.
> The 'set' part raises a question about the intention of SUS. The utime()
> function is in the standard but is explicitly limited to seconds (SUSv3:
> "The times in the structure utimbuf are measured in seconds since the
> Epoch."). The utimes() function is also in SUS and allows microsecond
> resolution ("The times in the timeval structure are measured in seconds
> and microseconds since the Epoch"), but this interface is marked LEGACY
> with a usage note indicating "For applications portability, the utime()
> function should be used instead of utimes()". I don't get it - why would
> the more capable interface be retired in favor of a dumber one? Is there
> a non-legacy interface that supersedes utimes() and support setting
> sub-second timestamps?
utime() is more widely available than utimes().
At one time, utimes() was an extension feature rather than a base feature.
They simply reserved the option to remove it ("may be withdrawn") later,
perhaps if there's not enough interest in keeping it.
Looks to me like coding for sub-second timestamps simply isn't maximally
portable.
--
mailto:rlhamil@smart.net http://www.smart.net/~rlhamil
Lasik/PRK theme music:
"In the Hall of the Mountain King", from "Peer Gynt"
[ Post a follow-up to this message ]
|