Timestamp

Guy Harris guy at auspex.auspex.com
Tue Jul 18 04:07:46 AEST 1989


>The implementation of such a routine would be highly system-
>dependent.  A somewhat standard but little-known routine already
>exists which provides what you want: ftime().

1) "somewhat standard" is the key word here.  In the UNIX world, it's in V7,
   and in 4.xBSD, but not in System V.

>It returns a structure which "contains the time since the epoch in seconds,
>[and] up to 1000 milliseconds of more-precise interval."

2) "more precise" doesn't necessarily mean "precise down to the
   millisecond"; it will probably reflect the resolution of the OSes
   clock, which is may well be closer to 10 milliseconds than one
   millisecond.

>If your vendor happens to provide an implementation of this
>routine, you're in luck; if not, there's not much portable you
>can do.

Unless your vendor happens to provide an implementation of
"gettimeofday()", which first appeared in 4.2BSD, and upon which
"ftime()" is implemented in 4.xBSD and many systems that picked up
"gettimeofday()" from it.  The previous comment about resolution applies
to it as well....



More information about the Comp.lang.c mailing list