Date: Tue, 5 Jan 2010 12:32:09 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r201574 - stable/8/lib/libc/gen Message-ID: <201001051232.o05CW9v8096463@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Tue Jan 5 12:32:09 2010 New Revision: 201574 URL: http://svn.freebsd.org/changeset/base/201574 Log: MFC r201194: Use clock_gettime(CLOCK_SECOND) instead of gettimeofday(2) for implementation of time(3). CLOCK_SECOND is much faster. Modified: stable/8/lib/libc/gen/time.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/gen/time.c ============================================================================== --- stable/8/lib/libc/gen/time.c Tue Jan 5 12:29:03 2010 (r201573) +++ stable/8/lib/libc/gen/time.c Tue Jan 5 12:32:09 2010 (r201574) @@ -37,13 +37,12 @@ __FBSDID("$FreeBSD$"); #include <sys/time.h> time_t -time(t) - time_t *t; +time(time_t *t) { - struct timeval tt; + struct timespec tt; time_t retval; - if (gettimeofday(&tt, (struct timezone *)0) < 0) + if (clock_gettime(CLOCK_SECOND, &tt) < 0) retval = -1; else retval = tt.tv_sec;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001051232.o05CW9v8096463>