aboutsummaryrefslogtreecommitdiff
path: root/bin/date
Commit message (Collapse)AuthorAgeFilesLines
* date: Improve nanosecond supportDag-Erling Smørgrav2025-11-113-53/+147
| | | | | | | | | | | | | Add support for a field width, which defaults to 9 if unspecified or zero. If the width is not exactly 9, we have to either cut off digits or append zeroes to make up the difference. If the width is a dash, we pick a width based on the clock's reported resolution. This brings us in line with GNU coreutils. PR: 287080 MFC after: 1 week Reviewed by: 0mp Differential Revision: https://reviews.freebsd.org/D53667
* date.1: Lint with mandocMateusz Piotrowski2025-11-051-17/+18
| | | | | | | | | | Specifically, remove Tn macors, replace Li with Ql, and escape %N to address date.1's rendering issues on man.freebsd.org. PR: 290801 Reported by: jinwookjeongg@gmail.com MFC after: 1 week Sponsored by: Klara, Inc.
* date(1): Improve manpage around '-I'Michael Osipov2025-09-011-4/+4
| | | | | | | | | | | * ISO 8601 defines two formats: basic and extended, clarify that we output the extended format only. * Clarify that ISO 8601 is only aware of timezone /offsets/, not timezones, it has no relation to the Olson timezone database (TZ environment variable). Reviewed by: otis (mentor), des MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D52314
* date: Documentation nits.Dag-Erling Smørgrav2024-09-101-3/+6
| | | | | | | | | | | * Fix spurious capitalization. * Fix inconsistent quoting. * Use `Dq` rather than ASCII double quotes. MFC after: 3 days Sponsored by: Klara, Inc. Reviewed by: 0mp Differential Revision: https://reviews.freebsd.org/D46622
* date: Fix a few nits.Dag-Erling Smørgrav2024-09-041-4/+4
| | | | | | | | | | | * Don't use `asprintf()` when `strdup()` can do the job just as well. * Fix a couple of typos in a comment. Fixes: eeb04a736cb9 MFC after: 3 days Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D46533
* Remove residual blank line at start of MakefileWarner Losh2024-07-152-2/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* date.1: Note that nanosecond support is to appear first in 14.1Mateusz Piotrowski2024-05-021-2/+2
| | | | Sponsored by: Klara, Inc.
* date: Correctly check outcome of mktime().Dag-Erling Smørgrav2024-04-281-1/+3
| | | | | | X-MFC-With: 7b390cb63689 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D44982
* date: Fix tests by initializing timespec structureMateusz Piotrowski2024-04-261-0/+2
| | | | | | | | | | The tests related to nanosecond support were failing on amd64 due to uninitialized timespec structure. Fixes: eeb04a736cb9 date: Add support for nanoseconds Reviewed by: markj Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D44975
* date: Add support for nanosecondsMateusz Piotrowski2024-04-263-35/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces support for a conversion specification for nanoseconds. The format of %N is meant to be compatible with that of GNU date. The nanoseconds conversion specification is implemented directly in date(1) instead of libc (in strftime(3)) to avoid introducing non-standard functions to libc at this time and modifying struct tm. Apart from introducing the nanoseconds conversion specification, this patch brings the following changes: - The "ns" format for ISO 8061 dates is now unlocked. E.g., date -Ins prints: 2024-04-22T12:20:28,763742224+02:00 - The -r flag when fed a file is now aware of the nanosecond part of the last modification time. - date(1) is now able to set the time with nanosecond precision. It is not possible as of now to do that by specifying nanoseconds directly via the command-line arguments. Instead, the -r flag can be used. - date(1) is now using the clock_gettime(3) family of functions instead of ctime(3) family of functions where possible. Reviewed by: des, markj Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D44905
* date(1): Grammar fixesChia-Jung Chang2024-02-131-3/+3
| | | | | Event: Advanced UNIX programming course (Fall'23) at NTHU Pull Request: https://github.com/freebsd/freebsd-src/pull/1035
* bin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Remove copyright strings ifdef'd outWarner Losh2023-11-271-9/+0
| | | | | | | | | | | We've ifdef'd out the copyright strings for some time now. Go ahead and remove the ifdefs. Plus whatever other detritis was left over from other recent removals. These copyright strings are present in the comments and are largely from CSRG's attempt at adding their copyright to every binary file (which modern interpretations of the license doesn't require). Sponsored by: Netflix
* bin: Remove ancient SCCS tags.Warner Losh2023-11-273-6/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* Remove $FreeBSD$: one-line nroff patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-165-5/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-162-4/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* Mark usage function as __dead2 in programs where it does not returnAlfonso Gregory2023-07-071-2/+2
| | | | | | | | 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
* bin/date: Upgrade calculations (take 2)Pedro F. Giffuni2023-07-041-10/+11
| | | | | | Use uint64_t instead of long, as this type is not correct for platforms like i386 or armv7. Pointed out by: imp
* bin/date: Upgrade calculationsPedro F. Giffuni2023-07-041-10/+10
| | | | | | | | Use long instead of int for numerous calculations, fixing a number of date calculation overflow issues. Obtained from: DragonflyBSD Git log: 4238ce6f0c6df33ce677ae298b245c62cd60fb43 (only partial)
* date: add -z output_zone optionBaptiste Daroussin2023-05-192-5/+29
| | | | | | | | | | | | | Inpired by OpenBSD date(1), this option allows to do timezone conversion via the date(1) command. For example, to determine when the BSDCan livestream begins for me: $ env -i TZ=EST5EDT date -z Europe/Paris -j 0900 MFC After: 1 week Reviewed by: kib, bcr (manpage) Differential Revision: https://reviews.freebsd.org/D40159
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-1/+0
|
* date.1: Make sure that the example works in any localeMateusz Piotrowski2023-04-131-2/+2
|
* date.1: Examples: Use syntax that is also compatible with cshMateusz Piotrowski2023-02-271-2/+2
| | | | | MFC after: 1 month Sponsored by: Klara Inc.
* date: remove some ambiguity in tzdata referencesKyle Evans2022-07-281-10/+8
| | | | | | | | | | | The use of 'package' in this could be understood to mean a FreeBSD package provided by pkg, rather than the fact that we use data provided by IANA. Re-word it to clearly identify `tzdata` as the IANA Time Zone Database on first use, then drop subsequent uses of the word 'package'. Reviewed by: 0mp, pauamma, philip Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D35966
* date: attempt to more accurately describe year limitations with -vKyle Evans2022-06-281-2/+10
| | | | | | | | | | | The previous description was both incorrect and incomplete in its description -- the 2038 limit doesn't apply on !i386 platforms, and it didn't note that values above 100 are accepted and interpreted differently. Further, it didn't note that absolute years are accepted. Reviewed by: pauamma_gundo.com (manpages) Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D35360
* Correct source markup. No change to output.Greg Lehey2022-03-301-8/+8
| | | | Reported by: 0mp@
* Remove reference to kernel clock time zone.Greg Lehey2022-03-301-2/+8
| | | | | | Add references. Reported by: philip@
* Describe modern time zone handling.Greg Lehey2022-03-281-11/+83
| | | | | Reviewed by: peterj@ MFC after: 2 weeks
* date: Capitalize seconds string in synopsesMateusz Piotrowski2021-11-032-4/+4
| | | | | | | | This makes it consistent with other date(1) implementations. Also, it feels more consistent since hours and minutes are already represented as HH and MM respectively. MFC after: 3 days
* date: Clean up synopsesMateusz Piotrowski2021-11-032-17/+38
| | | | MFC after: 3 days
* date.1: Fix some style issues and examplesMateusz Piotrowski2021-11-031-22/+27
| | | | | | | | | | | | | | | - Use Cm instead of Ar or Sq for command modifiers of the -v flag. - Remove unnecessary "Ar ..." from the synopsis. It's not clear what it was referring to. - Add missing arguments to the -f and -v flags. - Stylize the dot before "ss" with Cm in the default format in the -f flag description. - Set LC_ALL=C in the last example so that the output format of date(1) always matches the specified format of the -f flag not matter the locale. - List the -f flag as optional in all usage lines in the synopsis. MFC after: 3 days
* date.1: Remove mention of -d and -f flagsCeri Davies2021-06-161-2/+2
| | | | | | | | These flags were removed in 2019. PR: 256631 Submitted by: David Fiander <david@fiander.info> MFC After: 3 days
* date.1: note possibly surprising behaviour of -j -fEd Maste2020-08-261-1/+4
| | | | | | | | | PR: 248918 MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=364790
* Restore the -n flag parsing, but ignore it.Warner Losh2019-04-242-3/+7
| | | | | | | | | | Since D19668 was done, new users of the -n flag have surfaced. Parse and ignore it on the command line until they can be updated. Suggested by: rgrimes (in D19668). Notes: svn path=/head/; revision=346624
* Remove -n flag, fix setting date / timeWarner Losh2019-03-212-56/+22
| | | | | | | | | | r342139 bork setting the date. This fixes it by simply removing the -n flag. Differential Revision: https://reviews.freebsd.org/D19668 Notes: svn path=/head/; revision=345365
* Remove the -d and -t flags from the man pageWarner Losh2019-03-121-21/+1
| | | | | | | | | Remove -d and -t flags that were removed in r345050. Noticed by: rgrimes@ Notes: svn path=/head/; revision=345081
* Remove now useless -d and -t flags.Warner Losh2019-03-121-28/+3
| | | | | | | | | | | | | These were used to set dst flag and minutes west of UTC respectively. These are obsolete and have been removed form the kernel. These existed primarily to faithfully emulate early Unix ABIs that have been removed from FreeBSD. Reviewed by: jbh@, brooks@ Differential Revision: https://reviews.freebsd.org/D19550 Notes: svn path=/head/; revision=345050
* Remove, the now very outdated, timed.George V. Neville-Neil2018-12-155-226/+3
| | | | | | | | | | Submitted by: Kyle Spiers ksspiers at gmail Reviewed by: bcr,brooks,bz,sbruno Relnotes: yes Differential Revision: https://reviews.freebsd.org/D18505 Notes: svn path=/head/; revision=342139
* date(1): Add ISO 8601 formatting optionConrad Meyer2018-08-043-11/+219
| | | | | | | | The new flag is named '-I'. It is documented in the manual page and covered by basic unit tests. Notes: svn path=/head/; revision=337332
* Update other man pages to match leap second realityConrad Meyer2018-06-011-3/+3
| | | | | | | | | | | Missed these in r334501; see justification there: https://svnweb.freebsd.org/base?view=revision&revision=334501 Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=334502
* Fill in ut_id. While it's not relevant to the {OLD,NEW}_TIME entries,Warner Losh2018-01-231-0/+1
| | | | | | | | | we shouldn't leak stack garbage into the field. Sponsored by: Netflix Notes: svn path=/head/; revision=328282
* Fix mandoc -Tlint warnings in bin/Benjamin Kaduk2017-12-071-1/+2
| | | | | | | | | | | Many style-level issues are still reported. Submitted by: Yuri Pankov <yuripv@gmx.com> Reviewed by: jilles (previous revision) Differential Revision: https://reviews.freebsd.org/D13334 Notes: svn path=/head/; revision=326651
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-203-0/+6
| | | | | | | | | | | | | | | | | 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
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Add HAS_TESTS to all Makefiles that are currently using theEnji Cooper2017-08-021-0/+1
| | | | | | | | | `SUBDIR.${MK_TESTS}+= tests` idiom. This is a follow up to r321912. Notes: svn path=/projects/make-check-sandbox/; revision=321914
* Convert traditional ${MK_TESTS} conditional idiom for including testEnji Cooper2017-08-021-3/+1
| | | | | | | | | | | | | | directories to SUBDIR.${MK_TESTS} idiom This is being done to pave the way for future work (and homogenity) in ^/projects/make-check-sandbox . No functional change intended. MFC after: 1 weeks Notes: svn path=/head/; revision=321912
* date: avoid crash on invalid timeEd Maste2017-07-201-4/+8
| | | | | | | | | | | | | | localtime(3) returns NULL when passed an invalid time_t but date(1) previously did not handle it. Exit with an error in that case. PR: 220828 Reported by: Vinícius Zavam Reviewed by: cem, kevans Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D11660 Notes: svn path=/head/; revision=321293
* Renumber copyright clause 4Warner Losh2017-02-284-4/+4
| | | | | | | | | | | | 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