On Fri, 11 Mar 2005, john stultz wrote:
> +/* get_lowres_timestamp(): > + * Returns a low res timestamp. > + * (ie: the value of system_time as calculated at > + * the last invocation of timeofday_periodic_hook() ) > + */ > +nsec_t get_lowres_timestamp(void) > +{ > + nsec_t ret; > + unsigned long seq; > + do { > + seq = read_seqbegin(&system_time_lock); > + > + /* quickly grab system_time*/ > + ret = system_time; > + > + } while (read_seqretry(&system_time_lock, seq)); > + > + return ret; > +} On 64 bit platforms this could simply be a macro accessing "system time". > +/* do_gettimeofday(): > + * Returns the time of day > + */ > +void do_gettimeofday(struct timeval *tv) > +{ > + nsec_t wall, sys; > + unsigned long seq; > + > + /* atomically read wall and sys time */ > + do { > + seq = read_seqbegin(&system_time_lock); > + > + wall = wall_time_offset; > + sys = __monotonic_clock(); > + > + } while (read_seqretry(&system_time_lock, seq)); > + > + /* add them and convert to timeval */ > + *tv = ns2timeval(wall+sys); > +} > +EXPORT_SYMBOL(do_gettimeofday); Good. - 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/