commit 9d4b7162442fc1d0ee2a09bf8af41e48f95735f2 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 11:18:28 2019 -0400 Package init diff --git a/LicenseList b/LicenseList new file mode 100644 index 0000000..cd89325 --- /dev/null +++ b/LicenseList @@ -0,0 +1,36 @@ +src/time.c: GPLv3+ +COPYING: GPLv3 text +doc/time.texi: GFDL +doc/fdl.texi: GFDL 1.3 text +doc/time.info: GFDL +lib/stdnoreturn.in.h: GPLv3+ +lib/strerror-override.c: GPLv3+ +lib/error.h: GPLv3+ + Not in a binary package +tests/init.sh: GPLv3+ +INSTALL: FSFAP +configure: FSFUL +build-aux/config.guess: GPLv3+ with exceptions +build-aux/install-sh: MIT and Public Domain +build-aux/config.rpath: FSFULLR +build-aux/test-driver: GPLv2+ with exceptions +build-aux/update-copyright: GPLv3+ +build-aux/useless-if-before-free: GPLv3+ +build-aux/vc-list-files: GPLv3+ +build-aux/missing: GPLv2+ with exceptions +build-aux/compile: GPLv2+ with exceptions +build-aux/config.sub: GPLv3+ with exceptions +build-aux/gitlog-to-changelog: GPLv3+ +build-aux/git-version-gen: GPLv3+ +build-aux/texinfo.tex: GPLv3+ with exceptions +build-aux/depcomp: GPLv2+ with exceptions +build-aux/mdate-sh: GPLv2+ with exceptions +GNUmakefile: GPLv3+ +m4/asm-underscore.m4: FSFULLR +m4/gnulib-cache.m4: GPLv3+ with exceptions +m4/host-cpu-c-abi.m4: FSFULLR +m4/longlong.m4: FSFULLR +m4/ssize_t.m4: FSFULLR +m4/stdnoreturn.m4: FSFULLR +maint.mk: GPLv3+ +tests/time-posix-quiet.sh: GPLv3+ diff --git a/time-1.8-Prefer-clock_gettime-CLOCK_MONOTONIC.patch b/time-1.8-Prefer-clock_gettime-CLOCK_MONOTONIC.patch new file mode 100644 index 0000000..ec5c8aa --- /dev/null +++ b/time-1.8-Prefer-clock_gettime-CLOCK_MONOTONIC.patch @@ -0,0 +1,108 @@ +From a3c400a8553b598bc2fd01eb0f63c5748b2147e1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Wed, 8 Nov 2017 17:02:42 +0100 +Subject: [PATCH] Prefer clock_gettime(CLOCK_MONOTONIC) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +gettimeofday() reports wrong elapsed real time if a time step was +inserted while running a program. This can happen on initial time +adjustment from NTP server or by manual adjustement by date command. + +This patch uses clock_gettime(CLOCK_MONOTONIC) instead (if available) +that does not suffer from the issue. + + + +Signed-off-by: Petr Písař +--- + configure.ac | 3 +++ + src/resuse.c | 27 +++++++++++++++++++++++++-- + 2 files changed, 28 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index ede8fd5..d2950bd 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -72,6 +72,9 @@ dnl Checks for library functions. + AC_FUNC_VPRINTF + AC_FUNC_WAIT3 + AC_CHECK_FUNCS(strerror) ++AC_SEARCH_LIBS(clock_gettime, [rt]) ++test "$ac_cv_search_clock_gettime" != "no" && \ ++ AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [System provides clock_gettime() call]) + + + # What memory units are reported by getrusage(2) ? +diff --git a/src/resuse.c b/src/resuse.c +index d2ab870..ec54863 100644 +--- a/src/resuse.c ++++ b/src/resuse.c +@@ -26,7 +26,14 @@ + #include + #include + +-#if !HAVE_WAIT3 ++#if HAVE_WAIT3 ++# if HAVE_CLOCK_GETTIME ++# ifndef _POSIX_C_SOURCE ++# define _POSIX_C_SOURCE 199309L ++# endif ++# include ++# endif ++#else + # include + # ifndef HZ + # include +@@ -51,7 +58,14 @@ resuse_start (resp) + RESUSE *resp; + { + #if HAVE_WAIT3 ++#if HAVE_CLOCK_GETTIME ++ struct timespec res; ++ clock_gettime(CLOCK_MONOTONIC, &res); ++ resp->start.tv_sec = res.tv_sec; ++ resp->start.tv_usec = res.tv_nsec / 1000; ++#else + gettimeofday (&resp->start, (struct timezone *) 0); ++#endif /* !HAVE_CLOCK_GETTIME */ + #else + long value; + struct tms tms; +@@ -59,7 +73,7 @@ resuse_start (resp) + value = times (&tms); + resp->start.tv_sec = value / HZ; + resp->start.tv_usec = value % HZ * (1000000 / HZ); +-#endif ++#endif /* !HAVE_WAIT3 */ + } + + /* Wait for and fill in data on child process PID. +@@ -79,6 +93,9 @@ resuse_end (pid, resp) + int status; + + #if HAVE_WAIT3 ++#if HAVE_CLOCK_GETTIME ++ struct timespec res; ++#endif + pid_t caught; + + /* Ignore signals, but don't ignore the children. When wait3 +@@ -89,7 +106,13 @@ resuse_end (pid, resp) + return 0; + } + ++#if HAVE_CLOCK_GETTIME ++ clock_gettime(CLOCK_MONOTONIC, &res); ++ resp->elapsed.tv_sec = res.tv_sec; ++ resp->elapsed.tv_usec = res.tv_nsec / 1000; ++#else + gettimeofday (&resp->elapsed, (struct timezone *) 0); ++#endif + #else /* !HAVE_WAIT3 */ + long value; + struct tms tms; +-- +2.13.6 + diff --git a/time-1.9-Improve-info-directory-index-entry-description.patch b/time-1.9-Improve-info-directory-index-entry-description.patch new file mode 100644 index 0000000..99cc110 --- /dev/null +++ b/time-1.9-Improve-info-directory-index-entry-description.patch @@ -0,0 +1,32 @@ +From d8cf31417c84646497657280830c432b6f412495 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Mon, 18 Jun 2018 10:05:06 +0200 +Subject: [PATCH] Improve info directory index entry description +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Describing "time" as "time" is not explanatory. Use better +description. + +Signed-off-by: Petr Písař +--- + doc/time.texi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/doc/time.texi b/doc/time.texi +index 63d25b4..dac65b4 100644 +--- a/doc/time.texi ++++ b/doc/time.texi +@@ -28,7 +28,7 @@ Texts. A copy of the license is included in the section entitled + + @dircategory Basics + @direntry +-* Time: (time). time ++* Time: (time). GNU time utility. + @end direntry + + +-- +2.14.4 + diff --git a/time-1.9.tar.gz b/time-1.9.tar.gz new file mode 100644 index 0000000..f820239 Binary files /dev/null and b/time-1.9.tar.gz differ diff --git a/time.spec b/time.spec new file mode 100644 index 0000000..fe7dceb --- /dev/null +++ b/time.spec @@ -0,0 +1,50 @@ +Name: time +Version: 1.9 +Release: 6 +Summary: Monitoring the system resources used by running program +License: GPLv3+ and GFDL +URL: http://www.gnu.org/software/%{name}/ +Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.gz +Source1: LicenseList + +Patch0: time-1.8-Prefer-clock_gettime-CLOCK_MONOTONIC.patch +Patch1: time-1.9-Improve-info-directory-index-entry-description.patch + +BuildRequires: autoconf automake bash coreutils gcc make texinfo sed + +%description +This package runs another program and displays information +about the resources used by that program. The information is +collected by the system while the program was running. + +%package_help + +%description help +This package contains the document for %{name} + +%prep +%autosetup -n %{name}-%{version} -p1 + +%build +autoreconf -fi +%configure +make %{?_smp_mflags} + +%install +%make_install + +%check +make check %{?_smp_mflags} + +%files +%license COPYING +%{_bindir}/time +%exclude %{_infodir}/dir + +%files help +%doc AUTHORS ChangeLog NEWS README +%{_infodir}/time.info* + +%changelog +* Wed Aug 21 2019 openEuler Buildteam - 1.9-6 +- Package init