Date: Tue, 29 Dec 2009 12:47:48 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r201194 - head/lib/libc/gen Message-ID: <200912291247.nBTClmFC024548@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Tue Dec 29 12:47:47 2009 New Revision: 201194 URL: http://svn.freebsd.org/changeset/base/201194 Log: Use clock_gettime(CLOCK_SECOND) instead of gettimeofday(2) for implementation of time(3). CLOCK_SECOND is much faster. No objections from: phk Submitted by: Valentin Nechayev <netch segfault kiev ua> MFC after: 1 week Modified: head/lib/libc/gen/time.c Modified: head/lib/libc/gen/time.c ============================================================================== --- head/lib/libc/gen/time.c Tue Dec 29 11:27:51 2009 (r201193) +++ head/lib/libc/gen/time.c Tue Dec 29 12:47:47 2009 (r201194) @@ -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?200912291247.nBTClmFC024548>