From owner-svn-src-head@FreeBSD.ORG Tue Dec 29 12:47:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B13F10656AA; Tue, 29 Dec 2009 12:47:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2BE268FC20; Tue, 29 Dec 2009 12:47:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBTClmSX024551; Tue, 29 Dec 2009 12:47:48 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBTClmFC024548; Tue, 29 Dec 2009 12:47:48 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200912291247.nBTClmFC024548@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 29 Dec 2009 12:47:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201194 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2009 12:47:48 -0000 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 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 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;