summaryrefslogtreecommitdiffstats
path: root/bin/date/date.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r282608:delphij2015-05-211-2/+8
| | | | | | | | date(1): Make -r behave like GNU's version when the option can not be interpreted as a number, which checks the file's modification time and use that as the date/time value. This improves compatibility with GNU coreutils's version of date(1).
* date(1): Add "-R" flag to use RFC 2822 date and time output format [MFC]dumbbell2014-05-031-4/+20
| | | | | | | | | As stated in the man page, this is equivalent to use "%a, %d %b %Y %T %z" as the output format while LC_TIME is set to the "C" locale. This is compatible with date(1) from the GNU core utilities. This is an MFC of r264968 and r264970.
* Rework all non-contributed files that use `struct timezone'.ed2012-09-011-4/+4
| | | | | | | | | | | | | | 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.
* Port everything in bin/ from utmp to utmpx.ed2010-01-131-2/+1
| | | | | date: use libc utmpx routines instead of the ones provided by libulog. pax: don't depend on <utmp.h>
* Let date(1) use utmpx instead of logwtmp().ed2009-12-051-3/+9
| | | | | utmpx also has OLD_TIME/NEW_TIME messages, which seem to be intended for the same purpose as how we call logwtmp() here.
* Don't reset DST computed by strptime() (when e.g. setting theru2008-02-071-6/+3
| | | | | | | date via -f %s). Reported by: Eugene Grosbein Diagnosed by: Miguel Lopes Santos Ramos
* /*- or .\"- or #- to begin license clauses.imp2005-01-101-1/+1
|
* Remove clause 3 from the UCB licenses.markm2004-04-061-4/+0
| | | | OK'ed by: imp, core
* Rev. 1.32 moved a comment to the wrong line. The hack refered tomtm2004-03-041-2/+2
| | | | | | | | | | in the comment applies to a decision that needs to be made in relation to the year 2000. In fact, that statement probably should be changed to be more generic (getting the year from the current time perhaps). Otherwise, starting in 2069 two digit year conversions in date(1) will start assuming 1900 instead of 2000. hehe.
* Check for write errors; report and exit with error value.dds2003-10-041-0/+2
|
* Enclose sccsid according to style(9).charnier2003-02-051-2/+3
| | | | udp/timed -> timed/udp
* Staticify for lint.markm2002-10-181-2/+2
|
* Consistently use __FBSDIDobrien2002-06-301-2/+2
|
* Fix warnings inspired by lint, a commercial lint and WARNS=4.markm2002-02-221-4/+4
|
* o __P has been reovedimp2002-02-021-14/+9
| | | | | | | | | | | o Old-style K&R declarations have been converted to new C89 style o register has been removed o prototype for main() has been removed (gcc3 makes it an error) o int main(int argc, char *argv[]) is the preferred main definition. o Attempt to not break style(9) conformance for declarations more than they already are. Approved by: arch@, new style(9)
* Remove assumption that time_t is an intdillon2001-10-281-1/+3
| | | | MFC after: 1 day
* Add -j to the usage string.dd2001-06-091-1/+1
| | | | | PR: 27986 Submitted by: Cyrille Lefevre <clefevre@redirect.to>
* Fix an off-by-hour bug when crossing Daylight Saving Time boundary.ru2001-05-171-0/+3
| | | | | | PR: bin/27399 Submitted by: "Crist J. Clark" <crist.clark@globalstar.com> MFC after: 3 days
* Don't explicitly declare optarg and optind. These are declared inimp2000-08-161-2/+0
| | | | unistd.h, which is already included.
* Expand the -r option to support hex. Though undocumented, the -rjwd2000-07-221-1/+2
| | | | | | | | option already supported octal. Add a comment to the -r option in the man page so it's a bit more specific. Discrepancy brought to my attention by: sasdrq@unx.sas.com Approved by: jkh
* Correct confusion and differentiate appropriately between GMT and UTC whendbaker2000-05-191-3/+3
| | | | | | | | | date is launched with the "u" argument. It now operates in the documented manner. Fix typo in date man page. Submitted by: David McNett <nugget@slacker.com>
* Back out previous commit and replace with a cleaner solution adaptedsheldonh1999-12-291-11/+21
| | | | | | | | | | | | from the source attributed below. In particular, this removes a goto inside a switch and replaces those horrendous ATOI macros with something acceptable. More clean-ups to come. PR: bin/14151 Reported by: Christian Weisgerber <naddy@mips.rhein-neckar.de> Obtained from: NetBSD
* Allow the year to be specified with an optional century.sheldonh1999-11-101-2/+10
| | | | | PR: 14472 Reported by: j_guojun@lbl.gov (Jin Guojun)
* $Id$ -> $FreeBSD$peter1999-08-271-1/+1
|
* Don't continue if parsing failed when -f is in use. Exit with nonzero value.cracauer1999-06-251-3/+2
|
* the month and three days are up for -hackers and the 24hrs for -committers.jmg1999-05-141-18/+26
| | | | | | | | | | | | add a -j flag that tells date not to try to set the date. This allows you to use date as a userland interface to strptime. example: TZ=GMT date -j -f "%a, %d %b %Y %T %Z" "Sun, 08 Nov 1998 02:22:20 GMT" +%s which is the standard format for Last-modified headers in HTTP requests. only one to respond: eivind
* Support seconds with -v.brian1999-03-091-2/+2
| | | | | PR: 6308 Submitted by: Max Euston <meuston@jmrodgers.com>
* Added missing #include <string.h>alex1998-10-031-1/+2
|
* Restore Lite-2 sccsid. Restore include of sys/param.h.charnier1998-05-131-2/+3
|
* Correct use of .Nm and other cosmetics. Add rcsid. Remove unused #inc.charnier1998-05-061-5/+4
|
* Cast a size_t to a long to avoid a gcc warning.jb1998-01-251-3/+3
|
* Put [+format] at the end of the usage message.brian1997-12-111-3/+4
| | | | | | Make `date -?' output (pretty much) the same as the man page PR: 5269
* Back out suppress '\n' mod.danny1997-10-031-11/+6
|
* Add the '-s' flag to the usage string.danny1997-10-011-2/+2
|
* Add the ability to supress the '\n' at the end of the date printed.danny1997-10-011-5/+10
|
* Fix the broken `date HHMM.SS' handling.joerg1997-09-301-2/+3
| | | | | PR: bin/4661 Submitted by: blank@sliphost37.uni-trier.de (Sascha Blank)
* Remove forgotten debug statement.brian1997-08-101-2/+1
|
* Add "-f fmt date" for specification of thebrian1997-08-101-59/+80
| | | | | | | | date using strptime(3). Suggested by: Michael Smith <msmith@atrad.adelaide.edu.au> Change mm & dd to MM & DD so that they don't clash with the month.
* Change [-DMHW [+|-]val] to [-v [+|-]val[ymwdHM]]brian1997-08-091-11/+8
| | | | | Support Hours & Minutes Add -Wall to Makefile
* Add [-DWMY] flags for date adjustment.brian1997-08-041-4/+24
| | | | Discussed with: freebsd-hackers
* Cosmetic change in usage string.charnier1997-06-061-4/+4
|
* Fix typo in comment; Document in an example that years beyond 1999danny1997-04-161-2/+2
| | | | are handled; fix typo in same example.
* compare return value from getopt against -1 rather than EOF, per the finalimp1997-03-281-2/+2
| | | | posix standard on the topic.
* Revert $FreeBSD$ to $Id$peter1997-02-221-1/+1
|
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Merge Lite2 mods, fix incorrect default string, cleanupsteve1996-12-141-3/+3
| | | | use of .Nm macros, and -Wall cleaning.
* For nonexisten time use proper diagnostic instead of bad format and usageache1996-04-061-2/+2
|
* Add setlocale(LC_TIME,...ache1995-10-231-1/+3
|
* Use %+ to print data using LC_TIMEache1995-08-051-2/+2
|
* date(1) didn't emit a final newline if the format had been specifiedjoerg1995-04-031-3/+3
| | | | | | with `+'. This breaks tradition and violates Posix 1003.2. Discoverd by: luigi@labinfo.iet.unipi.it (Luigi Rizzo)
OpenPOWER on IntegriCloud