Remove 'clock()' implementation, print warning

FreeBSD implements 'clock' with an accuracy of 128 ticks-per-second for
compatibility reasons, Linux uses 1000000 per-second. Remove 'clock' and
print an error because it is unlikely that this is the resolution
expected by the application.

Fix #3057
This commit is contained in:
Ehmry - 2018-11-24 14:53:52 +01:00 committed by Norman Feske
parent 82ded858aa
commit 5c2599e24e
2 changed files with 15 additions and 1 deletions

View File

@ -8,6 +8,9 @@ FILTER_OUT_C += \
devname.c feature_present.c getpagesizes.c getvfsbyname.c \
setproctitle.c sysconf.c sysctlbyname.c
# the following is a wrapper over rusage, which we cannot provide
FILTER_OUT_C += clock.c
SRC_C = $(filter-out $(FILTER_OUT_C),$(notdir $(wildcard $(LIBC_GEN_DIR)/*.c)))
# 'sysconf.c' includes the local 'stdtime/tzfile.h'

View File

@ -6,7 +6,7 @@
*/
/*
* Copyright (C) 2010-2017 Genode Labs GmbH
* Copyright (C) 2010-2018 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
@ -18,6 +18,9 @@
#include "task.h"
#include "libc_errno.h"
/* Genode includes */
#include <base/log.h>
namespace Libc { time_t read_rtc(); }
@ -91,3 +94,11 @@ int gettimeofday(struct timeval *tv, struct timezone *)
tv->tv_usec = ts.tv_nsec / 1000;
return 0;
}
extern "C"
clock_t clock()
{
Genode::error(__func__, " not implemented, use 'clock_gettime' instead");
return -1;
}