svn commit: trunk/uClibc/libc/sysdeps/linux/common

pkj at uclibc.org pkj at uclibc.org
Tue Sep 19 07:44:15 UTC 2006


Author: pkj
Date: 2006-09-19 00:44:15 -0700 (Tue, 19 Sep 2006)
New Revision: 16144

Log:
Allow the res argument to clock_getres() to be NULL.


Modified:
   trunk/uClibc/libc/sysdeps/linux/common/clock_getres.c


Changeset:
Modified: trunk/uClibc/libc/sysdeps/linux/common/clock_getres.c
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/common/clock_getres.c	2006-09-19 01:29:11 UTC (rev 16143)
+++ trunk/uClibc/libc/sysdeps/linux/common/clock_getres.c	2006-09-19 07:44:15 UTC (rev 16144)
@@ -18,15 +18,18 @@
 
 int clock_getres(clockid_t clock_id, struct timespec* res)
 {
-	long clk_tck;
 	int retval = -1;
 
 	switch (clock_id) {
 		case CLOCK_REALTIME:
-			if ((clk_tck = sysconf(_SC_CLK_TCK)) < 0)
-				clk_tck = 100;
-			res->tv_sec = 0;
-			res->tv_nsec = 1000000000 / clk_tck;
+			if (res) {
+				long clk_tck;
+
+				if ((clk_tck = sysconf(_SC_CLK_TCK)) < 0)
+					clk_tck = 100;
+				res->tv_sec = 0;
+				res->tv_nsec = 1000000000 / clk_tck;
+			}
 			retval = 0;
 			break;
 




More information about the uClibc-cvs mailing list