History log of /freebsd-10.1-release/bin/date/date.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 265265 03-May-2014 dumbbell

date(1): Add "-R" flag to use RFC 2822 date and time output format [MFC]

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.


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 239991 01-Sep-2012 ed

Rework all non-contributed files that use `struct timezone'.

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.


# 202193 13-Jan-2010 ed

Port everything in bin/ from utmp to utmpx.

date: use libc utmpx routines instead of the ones provided by libulog.
pax: don't depend on <utmp.h>


# 200157 05-Dec-2009 ed

Let date(1) use utmpx instead of logwtmp().

utmpx also has OLD_TIME/NEW_TIME messages, which seem to be intended for
the same purpose as how we call logwtmp() here.


# 176094 07-Feb-2008 ru

Don't reset DST computed by strptime() (when e.g. setting the
date via -f %s).

Reported by: Eugene Grosbein
Diagnosed by: Miguel Lopes Santos Ramos


# 139969 10-Jan-2005 imp

/*- or .\"- or #- to begin license clauses.


# 127958 06-Apr-2004 markm

Remove clause 3 from the UCB licenses.

OK'ed by: imp, core


# 126605 04-Mar-2004 mtm

Rev. 1.32 moved a comment to the wrong line. The hack refered to
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.


# 120729 04-Oct-2003 dds

Check for write errors; report and exit with error value.


# 110390 05-Feb-2003 charnier

Enclose sccsid according to style(9).
udp/timed -> timed/udp


# 105396 18-Oct-2002 markm

Staticify for lint.


# 99109 30-Jun-2002 obrien

Consistently use __FBSDID


# 91079 22-Feb-2002 markm

Fix warnings inspired by lint, a commercial lint and WARNS=4.


# 90108 02-Feb-2002 imp

o __P has been reoved
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)


# 85615 28-Oct-2001 dillon

Remove assumption that time_t is an int

MFC after: 1 day


# 77934 09-Jun-2001 dd

Add -j to the usage string.

PR: 27986
Submitted by: Cyrille Lefevre <clefevre@redirect.to>


# 76749 17-May-2001 ru

Fix an off-by-hour bug when crossing Daylight Saving Time boundary.

PR: bin/27399
Submitted by: "Crist J. Clark" <crist.clark@globalstar.com>
MFC after: 3 days


# 64692 16-Aug-2000 imp

Don't explicitly declare optarg and optind. These are declared in
unistd.h, which is already included.


# 63761 22-Jul-2000 jwd

Expand the -r option to support hex. Though undocumented, the -r
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


# 60718 19-May-2000 dbaker

Correct confusion and differentiate appropriately between GMT and UTC when
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>


# 55225 29-Dec-1999 sheldonh

Back out previous commit and replace with a cleaner solution adapted
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


# 53082 10-Nov-1999 sheldonh

Allow the year to be specified with an optional century.

PR: 14472
Reported by: j_guojun@lbl.gov (Jin Guojun)


# 50471 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 48214 25-Jun-1999 cracauer

Don't continue if parsing failed when -f is in use. Exit with nonzero value.


# 47129 13-May-1999 jmg

the month and three days are up for -hackers and the 24hrs for -committers.

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


# 44598 09-Mar-1999 brian

Support seconds with -v.
PR: 6308
Submitted by: Max Euston <meuston@jmrodgers.com>


# 39925 03-Oct-1998 alex

Added missing #include <string.h>


# 36006 13-May-1998 charnier

Restore Lite-2 sccsid. Restore include of sys/param.h.


# 35773 06-May-1998 charnier

Correct use of .Nm and other cosmetics. Add rcsid. Remove unused #inc.


# 32756 25-Jan-1998 jb

Cast a size_t to a long to avoid a gcc warning.


# 31668 11-Dec-1997 brian

Put [+format] at the end of the usage message.
Make `date -?' output (pretty much) the same as
the man page
PR: 5269


# 30073 03-Oct-1997 danny

Back out suppress '\n' mod.


# 30021 01-Oct-1997 danny

Add the '-s' flag to the usage string.


# 30020 01-Oct-1997 danny

Add the ability to supress the '\n' at the end of the date printed.


# 30013 30-Sep-1997 joerg

Fix the broken `date HHMM.SS' handling.

PR: bin/4661
Submitted by: blank@sliphost37.uni-trier.de (Sascha Blank)


# 28038 10-Aug-1997 brian

Remove forgotten debug statement.


# 28037 10-Aug-1997 brian

Add "-f fmt date" for specification of the
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.


# 28025 09-Aug-1997 brian

Change [-DMHW [+|-]val] to [-v [+|-]val[ymwdHM]]
Support Hours & Minutes
Add -Wall to Makefile


# 27874 04-Aug-1997 brian

Add [-DWMY] flags for date adjustment.
Discussed with: freebsd-hackers


# 26465 06-Jun-1997 charnier

Cosmetic change in usage string.


# 24976 16-Apr-1997 danny

Fix typo in comment; Document in an example that years beyond 1999
are handled; fix typo in same example.


# 24348 28-Mar-1997 imp

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


# 22988 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

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.


# 20413 14-Dec-1996 steve

Merge Lite2 mods, fix incorrect default string, cleanup
use of .Nm macros, and -Wall cleaning.


# 15068 05-Apr-1996 ache

For nonexisten time use proper diagnostic instead of bad format and usage


# 11738 23-Oct-1995 ache

Add setlocale(LC_TIME,...


# 9944 05-Aug-1995 ache

Use %+ to print data using LC_TIME


# 7608 03-Apr-1995 joerg

date(1) didn't emit a final newline if the format had been specified
with `+'. This breaks tradition and violates Posix 1003.2.

Discoverd by: luigi@labinfo.iet.unipi.it (Luigi Rizzo)


# 5233 26-Dec-1994 bde

Obtained from: partly from 386BSD-0.1.2.4

Fix several bugs involving the obsolescent -d and -t options:
-d 0 and -t 0 were ignored
-t -600 was a usage error
-d 'atoi is not suitable for parsing args' and -t duh were not usage errors

Change some error messages to say which call to settimeofday failed.

Restore casts of NULL in function calls.

Finish conversion to using err() instead of perror().


# 3044 24-Sep-1994 dg

Added $Id$


# 1557 26-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1556,
which included commits to RCS files with non-trunk default branches.


# 1556 26-May-1994 rgrimes

BSD 4.4 Lite bin Sources