On Mon, 13 Feb 2006, Ulrich Windl wrote:
> There's a hacked-on getnstimeofday() which, what I discovered doesn't actually
> pass along the nanosecond resolution of xtime. It does:
This is the fall back function for arches without nanosecond
resolution....
> The proper solution most likely is to define POSIX compatible routines with
> nanosecond resolution, and then define the microsecond-resolution from those, and
> not the other way round.
Right.
> -#ifdef CONFIG_TIME_INTERPOLATION
> +/* get system time with nanosecond accuracy */
> void getnstimeofday (struct timespec *tv)
> {
> - unsigned long seq,sec,nsec;
> -
> + unsigned long seq, nsec, sec, offset;
> do {
> seq = read_seqbegin(&xtime_lock);
> +#ifdef CONFIG_TIME_INTERPOLATION
> + offset = time_interpolator_get_offset();
> +#else
> + offset = 0;
> +#endif
> sec = xtime.tv_sec;
> - nsec = xtime.tv_nsec+time_interpolator_get_offset();
> + nsec = xtime.tv_nsec + offset;
> } while (unlikely(read_seqretry(&xtime_lock, seq)));
>
> +#ifdef CONFIG_TIME_INTERPOLATION
> while (unlikely(nsec >= NSEC_PER_SEC)) {
> nsec -= NSEC_PER_SEC;
> ++sec;
> }
> +#endif
> tv->tv_sec = sec;
> tv->tv_nsec = nsec;
> }
> EXPORT_SYMBOL_GPL(getnstimeofday);
Looks okay.
> +#ifdef CONFIG_TIME_INTERPOLATION
> +/* this is a mess: there are also architecture-dependent ``do_gettimeofday()''
> + * and ``do_settimeofday()''
> + */
Yes, we would like to get rid of the arch specific
do_get/settimeofday() in the future.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]