aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/time/time.c
Commit message (Collapse)AuthorAgeFilesLines
* Purge more stray embedded $FreeBSD$ stringsJohn Baldwin2023-10-241-2/+0
| | | | | | | | | These do not use __FBSDID but instead use bare char arrays. Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D41957 (cherry picked from commit eba230afba4932f02a1ca44efc797cf7499a5cb0)
* Mark usage function as __dead2 in programs where it does not returnAlfonso Gregory2023-09-141-1/+1
| | | | | | | | | | In most cases, usage does not return, so mark them as __dead2. For the cases where they do return, they have not been marked __dead2. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/735 (cherry picked from commit cccdaf507eee8fb34494b4624eb85bb951e323c8)
* time(1): use the monotonic clockAlan Somers2018-05-041-3/+3
| | | | | | | | | | | The monotonic clock is more appropriate than the realtime clock for measuring durations. Reviewed by: ken, jilles Differential Revision: https://reviews.freebsd.org/D14032 Notes: svn path=/head/; revision=333251
* time(1): use clock_gettime(2) instead of gettimeofday(2)Alan Somers2018-01-241-17/+21
| | | | | | | | | | | | This is a prerequisite to adding support for the monotonic clock Reviewed by: ken, imp MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D14030 Notes: svn path=/head/; revision=328343
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-1/+3
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Don't do things we aren't allowed to do in a signal handler... DeferJohn-Mark Gurney2015-05-181-6/+12
| | | | | | | | | | | the work to the main thread... This fixes a possible crash if SIGINFO is delivered at the wrong time... This still leaves getrusage broken for some reason, but I believe that is a kernel issue and cannot be fixed here... Notes: svn path=/head/; revision=283073
* time: Use close-on-exec instead of fclose() in the child process.Jilles Tjoelker2012-12-081-3/+1
| | | | Notes: svn path=/head/; revision=244034
* Rework all non-contributed files that use `struct timezone'.Ed Schouten2012-09-011-3/+3
| | | | | | | | | | | | | | | | | This structure is not part of POSIX. According to POSIX, gettimeofday() has the following prototype: int gettimeofday(struct timeval *restrict tp, void *restrict tzp); Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is not used). Remove dead error handling code. Also use NULL for a nul-pointer instead of integer 0. While there, change all pieces of code that only use tv_sec to use time(3), as this provides less overhead. Notes: svn path=/head/; revision=239991
* Remove the advertising clause from UCB copyrighted files in usr.bin. ThisJoel Dahl2010-12-111-4/+0
| | | | | | | | | | | | is in accordance with the information provided at ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change Also add $FreeBSD$ to a few files to keep svn happy. Discussed with: imp, rwatson Notes: svn path=/head/; revision=216370
* Revert most part of 200420 as requested, as more review and polish isXin LI2009-12-131-0/+1
| | | | | | | needed. Notes: svn path=/head/; revision=200462
* Remove unneeded header includes from usr.bin/ except contributed code.Xin LI2009-12-111-1/+0
| | | | | | | Tested with: make universe Notes: svn path=/head/; revision=200420
* Cast to intmax_t to print tv_sec in struct timeval.David Malone2007-05-071-16/+17
| | | | | | | | Avoid shadowing a global variable with a function argument. Set WARNS to 6. Notes: svn path=/head/; revision=169346
* Handle SIGINFO in time(1) by printing the time the given command is running.Pawel Jakub Dawidek2006-05-141-37/+63
| | | | | | | I find it quite handy to just hit ^T and see the time. Notes: svn path=/head/; revision=158560
* o Close an output file -o flag opened before execvp(3) in a child.Maxim Konovalov2006-04-161-0/+2
| | | | | | | | | PR: bin/89666 Submitted by: Arne H Juul MFC after: 1 month Notes: svn path=/head/; revision=157796
* Sync program's usage() with manpage's SYNOPSIS.Ruslan Ermilov2005-05-211-1/+1
| | | | Notes: svn path=/head/; revision=146466
* Uses wait4() instead of wait3() when waiting for a child process to exit.Sean Chittenden2003-10-171-1/+1
| | | | | | | Reviewed by: yar Notes: svn path=/head/; revision=121153
* Assorted minor fixes, mostly style(9):Yaroslav Tykhiy2003-10-041-12/+16
| | | | | | | | | | | - PID should be pid_t, not int; - sort #include's and local variables; - don't overuse initializers; - use warn(3) instead of perror(3) consistently; - amplify the comment on signals. Notes: svn path=/head/; revision=120747
* Don't dump core from the time(1) process itselfYaroslav Tykhiy2003-10-041-1/+6
| | | | | | | | if the child process has exited on a signal whose default action is to dump core. Notes: svn path=/head/; revision=120744
* ANSIify function definitions.David Malone2002-09-041-10/+5
| | | | | | | | | | | | Add some constness to avoid some warnings. Remove use register keyword. Deal with missing/unneeded extern/prototypes. Some minor type changes/casts to avoid warnings. Reviewed by: md5 Notes: svn path=/head/; revision=102944
* Make it obvious that command line arguments may be specified for the utilityTim J. Robbins2002-06-201-1/+2
| | | | | | | | that is to be invoked on the command line. Use "utility" instead of "command" in manual page and usage message for consistency with POSIX. Notes: svn path=/head/; revision=98476
* Determine exit status to use before writing diagnostic message; warn()Tim J. Robbins2002-05-251-6/+1
| | | | | | | may change errno. Notes: svn path=/head/; revision=97268
* remove __PWarner Losh2002-03-221-3/+3
| | | | Notes: svn path=/head/; revision=92922
* Fix one warning - still not warns clean.David Malone2001-12-031-1/+1
| | | | Notes: svn path=/head/; revision=87300
* Localize it (LC_NUMERIC)Andrey A. Chernov2001-02-101-13/+25
| | | | Notes: svn path=/head/; revision=72338
* Remove vestages of a previous implimentation of "-h".David E. O'Brien2000-10-311-2/+2
| | | | | | | Submitted by: Tony Finch <dot@dotat.at> Notes: svn path=/head/; revision=68029
* Add a new "-h" Human-friendly h/m/s output format.David E. O'Brien2000-10-281-4/+40
| | | | | | | Reviewed by: bde Notes: svn path=/head/; revision=67813
* getopt and friends are declared in <unistd.h>Warner Losh2000-09-041-3/+0
| | | | | | | getopt returns -1 not EOF. Notes: svn path=/head/; revision=65428
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Adds the '-p' option to make time(1) output POSIX.2 compliant.Ollivier Robert1999-03-101-11/+32
| | | | | | | | | | | | | Updates the manpage as well. I've rewritten the patch as it was for 2.2.7. It can probably be put into 3.1-STABLE as well. PR: bin/10515 Submitted by: Jens Schweikhardt <schweikh@noc.dfn.de> Notes: svn path=/head/; revision=44640
* Calls one or more of malloc(), warn(), err(), syslog(), execlp() orDag-Erling Smørgrav1998-10-131-2/+2
| | | | | | | | | | | | | | execvp() in the child branch of a vfork(). Changed to use fork() instead. Some of these (mv, find, apply, xargs) might benefit greatly from being rewritten to use vfork() properly. PR: Loosely related to bin/8252 Approved by: jkh and bde Notes: svn path=/head/; revision=40301
* When exiting on SIGINT, exit with signal statusMartin Cracauer1998-08-241-2/+12
| | | | Notes: svn path=/head/; revision=38520
* Brucifixion.Dag-Erling Smørgrav1998-07-281-15/+12
| | | | Notes: svn path=/head/; revision=37913
* Behave like GNU time. More cleanup. Reword man page.Dag-Erling Smørgrav1998-07-271-8/+3
| | | | | | | Pointed out by: Bruce Evans Notes: svn path=/head/; revision=37891
* Clean up the previous commit.Dag-Erling Smørgrav1998-07-271-24/+24
| | | | Notes: svn path=/head/; revision=37888
* By default, /usr/bin/time writes its output to stderr. Two optionsPoul-Henning Kamp1998-07-241-19/+45
| | | | | | | | | | | | | have been added to time(1) to write output to an alternative destination. Option "-f filename" will write to filename, and filename can be - to write to stdout. Option "-a filename" will append the output to filename. Time(1) man page has been updated to reflect the change. PR: 7368 Submitted by: Steven G. Kargl <kargl@troutmask.apl.washington.edu> Notes: svn path=/head/; revision=37855
* Add usage() and use err(3).Philippe Charnier1997-08-141-8/+19
| | | | Notes: svn path=/head/; revision=28203
* compare return value from getopt against -1 rather than EOF, per the finalWarner Losh1997-03-291-1/+1
| | | | | | | posix standard on the topic. Notes: svn path=/head/; revision=24360
* Close PR#1781 - time returns with EXIT_SUCCESS on some failuresJordan K. Hubbard1996-10-121-1/+3
| | | | | | | Submitted-By: Tor Egge <Tor.Egge@idt.ntnu.no> Notes: svn path=/head/; revision=18889
* Fix a bug under time's "-l" option. The values reported for averageJohn Polstra1996-07-301-1/+24
| | | | | | | | | | | | | shared memory size, average unshared data size, and average unshared stack size were too high by a factor of 128/100, because the program used a hard-coded hz value of 100. The correct value is the frequency of the statistics clock, currently 128. The program now uses sysctl to get the stathz value from the kernel. Discussed with: bde@freebsd.org (Bruce Evans) Notes: svn path=/head/; revision=17351
* Close out PR#723: time -l dumps corePaul Traina1995-10-281-1/+9
| | | | Notes: svn path=/head/; revision=11873
* BSD 4.4 Lite Usr.bin SourcesRodney W. Grimes1994-05-271-0/+140
Notes: svn path=/cvs2svn/branches/CHRISTOS/; revision=1590