Commit Graph

15 Commits

Author SHA1 Message Date
Yaroslav Tykhiy
d3e240cb45 Change the behaviour of `-v' so that, e.g., stepping a month back
on March 31 won't take you to March 2 or 3 (now the result will
be the last day of February.)

In general, now stepping by months from the last days of the current
month A will take you to the very last day of the target month B if
B is shorter than A.

The previous version would just step to March 31 and rely on mktime(3)
to correct the date.  Despite its simplicity, such way was counter-intuitive
to users and caused pain to shell script writers.

Noticed by:	Igor Timkin <ivt at gamma dot ru>
Approved by:	brian
MFC after:	2 weeks
2004-08-09 13:43:39 +00:00
David E. O'Brien
5eb43ac2f7 Consistently use __FBSDID 2002-06-30 05:13:54 +00:00
Mark Murray
9afa09cd0e Fix warnings inspired by lint, a commercial lint and WARNS=4. 2002-02-22 20:51:00 +00:00
Brian Somers
6e4cd31d99 Exit if malloc() returns NULL
Submitted by: Chris Faulhaber <jedgar@fxp.org>
2000-12-01 09:59:40 +00:00
Brian Somers
7ecff35b0d Propogate the ``call mktime'' flag from adjwday() down to adjday().
Submitted by: Christian Weisgerber <naddy@mips.inka.de>
2000-05-23 23:58:18 +00:00
Brian Somers
9263db41f6 Change -v so that variences in units of days or less are sensitive to
DST.  Explain in more detail what date -v does when mixed with DST.

Previous code suggested broken by: wollman
2000-04-12 13:35:17 +00:00
Brian Somers
a625bfec63 Always give mktime a timeval with tm_isdst set to -1, otherwise
things get a bit out-of-phase when we step backwards 1 hour from
between 0:00 and 1:00 on the first of the month following the
transition into Summer time.  This is probably actually a bug
in mktime().

PR:	10963

If mktime() fails and 68 < year < 138, assume that the reason is
because of Summer time and adjust up or down according to our
adjusting context by one hour.  This assumes that all DSTs are
multiples of 1 hour.

PR:	6223, 17750
2000-04-05 01:59:36 +00:00
Alfred Perlstein
3b006d8ebd Re-add "May" to the list of dates supported.
Approved by: jkh
2000-02-18 23:41:45 +00:00
Peter Wemm
2a4562393f $Id$ -> $FreeBSD$ 1999-08-27 23:15:48 +00:00
Warner Losh
426e9c1dcc First set of fixes to keep egcs happy. These include {} around single
statement if blocks[*] when the else could be ambiguous, not defaulting
to int type and removal of some unused variables.

[*] This is explicitly allowed by style(9) when the single statement
spans more than one line.

Reviewed by: obrien, chuckr
1999-04-25 21:13:34 +00:00
Brian Somers
269dfbee64 Support seconds with -v.
PR:		6308
Submitted by:	Max Euston <meuston@jmrodgers.com>
1999-03-09 09:38:54 +00:00
Philippe Charnier
cbf6f7d358 Correct use of .Nm and other cosmetics. Add rcsid. Remove unused #inc. 1998-05-06 06:51:42 +00:00
Brian Somers
c39934ea32 Add (BSD) copyright headers. 1997-12-21 12:11:13 +00:00
Brian Somers
698f86e401 Change [-DMHW [+|-]val] to [-v [+|-]val[ymwdHM]]
Support Hours & Minutes
Add -Wall to Makefile
1997-08-09 22:34:06 +00:00
Brian Somers
7ca215a690 Add [-DWMY] flags for date adjustment.
Discussed with: freebsd-hackers
1997-08-04 03:37:07 +00:00