Home | History | Annotate | Download | only in dev
History log of /src/sys/dev/clock_subr.c
RevisionDateAuthorComments
 1.27  15-Aug-2016  jakllsch Fix leap year handling for years 2100 and greater.

I can not explain why this works and the existing code doesn't.
Maybe it has something to do with leap years happening at the end of a
four year period and not at the beggining, and there being no year 0?
 1.26  22-Dec-2014  christos use symbolic constants (Kamil Rytarowski)
 1.25  17-Nov-2014  joerg branches: 1.25.2;
Needs sys/clock.h. Use a relative include path here to ease src/tools
build.
 1.24  17-Nov-2014  christos make this compile again.
 1.23  17-Nov-2014  christos PR/49207: Kamil Rytarowski: Add sys/clock.h with generic time macros
(derived from clock_subr.h). Keep clock_subr.h with the kernel structures
and functions to reduce diffs, and have clock.h only include standalone
constants and macros.
 1.22  07-Sep-2014  martin Avoid overflowing the "year" value by making the field uint64_t. Adapt
arguments and local variables accordingly.
This now fixes PR 49144 for real.
 1.21  06-Sep-2014  martin Counting leap years was fine while we had 32bit time_t - but now it
is not a good idea for dates far away in the future.
For dates in the year 2000 or later, use arithmetic instead (since the
repeating periods are well aligned). Should fix PR 49144.
 1.20  01-Sep-2014  apb If HAVE_NBTOOL_CONFIG_H is set, then include "nbtool_config.h",
because this file is compiled as part of tools/makefs.
 1.19  01-Sep-2014  apb Revert previous; test secs > __type_max(time_t) again, now
that __type_max is available in tools/compat/compat_defs.h.
 1.18  01-Sep-2014  martin Reformulate an overflow test so it can be used in tool builds (i.e. does
not depend on netbsd specific macros).
 1.17  31-Aug-2014  martin Make this compile- and usable from userland as well.
 1.16  08-Feb-2011  rmind branches: 1.16.14; 1.16.30;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.15  12-Dec-2009  tsutsui branches: 1.15.4; 1.15.6; 1.15.8;
Use time_t to calculate days and secs to avoid potential overflow.
 1.14  12-Dec-2009  tsutsui KNF
 1.13  14-Feb-2009  perry convert to ANSI function prototypes
 1.12  11-Dec-2005  christos branches: 1.12.74; 1.12.84; 1.12.90;
merge ktrace-lwp.
 1.11  04-Feb-2005  perry de-__P
 1.10  29-Dec-2004  bjh21 branches: 1.10.2; 1.10.4;
In clock_ymdhms_to_secs(), rather than returning rubbish when presented with
a year before 1970 or a date beyond the time_t rollover, return -1 so callers
can detect it. Callers which expect the function not to fail just get a
different kind of rubbish from before.
 1.9  13-Aug-2003  ragge sys/types.h -> sys/param.h to get vax inlines correct.
 1.8  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7  13-Nov-2001  lukem branches: 1.7.16;
add RCSIDs
 1.6  07-Jul-2001  thorpej branches: 1.6.2;
bcopy -> memcpy
bzero -> memset
 1.5  03-Oct-2000  tsutsui branches: 1.5.2;
Move #define POSIX_BASE_YEAR to clock_subr.h.
 1.4  14-Oct-1997  gwr branches: 1.4.16;
Minor improvement to avoid re-defining days_in_month().
 1.3  15-Mar-1997  is branches: 1.3.4;
New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.2  20-Feb-1997  gwr branches: 1.2.2;
Improve a comment.
 1.1  19-Feb-1997  gwr Shared functions to convert between year/month/day/hour/minute/second
and "seconds since 1970" (POSIX time_t). See sys/arch/sun3/sun3/clock.c
for an example of how these can be used.
 1.2.2.2  12-Mar-1997  is Merge in changes from Trunk
 1.2.2.1  20-Feb-1997  is file clock_subr.c was added on branch is-newarp on 1997-03-12 21:21:46 +0000
 1.3.4.1  15-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.16.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.2.2  14-Nov-2001  nathanw Catch up to -current.
 1.5.2.1  24-Aug-2001  nathanw Catch up with -current.
 1.6.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.16.5  04-Feb-2005  skrll Sync with HEAD.
 1.7.16.4  17-Jan-2005  skrll Sync with HEAD.
 1.7.16.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.16.2  18-Sep-2004  skrll Sync with HEAD.
 1.7.16.1  03-Aug-2004  skrll Sync with HEAD
 1.10.4.1  12-Feb-2005  yamt sync with head.
 1.10.2.1  29-Apr-2005  kent sync with -current
 1.12.90.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.12.84.1  03-Mar-2009  skrll Sync with HEAD.
 1.12.74.2  11-Mar-2010  yamt sync with head
 1.12.74.1  04-May-2009  yamt sync with head.
 1.15.8.1  17-Feb-2011  bouyer Sync with HEAD
 1.15.6.1  06-Jun-2011  jruoho Sync with HEAD.
 1.15.4.1  05-Mar-2011  rmind sync with head
 1.16.30.1  12-Nov-2014  snj Pull up following revision(s) (requested by martin in ticket #216):
share/man/man9/todr.9: revision 1.17
sys/arch/sh3/dev/rtc.c: revision 1.9
sys/dev/clock_subr.c: revision 1.17-1.22
sys/dev/clock_subr.h: revision 1.22
sys/fs/msdosfs/msdosfs_conv.c: revision 1.10
tools/compat/compat_defs.h: revision 1.98
tools/compat/dev/clock_subr.h: revision 1.1-1.2
usr.sbin/makefs/msdos/Makefile.inc: revision 1.6
clock_secs_to_ymdhms(9) takes seconds as a time_t, not int.
--
Make this compile- and usable from userland as well.
--
Add a slightly stripped down version of sys/dev/clock/clock_subr.h to make
this code available for tools.
--
Reformulate an overflow test so it can be used in tool builds (i.e. does
not depend on netbsd specific macros).
--
Make msdosfs time conversion use the y/m/d/h/m/s conversion functions
from clock_subr.c and compile that into the userland (and tools)
makefs as well.
--
Copy definitions of __type_min(t), __type_max(t), and some related macros,
from <sys/cdefs.h>, for use when building tools.
--
Revert previous; test secs > __type_max(time_t) again, now
that __type_max is available in tools/compat/compat_defs.h.
--
If HAVE_NBTOOL_CONFIG_H is set, then include "nbtool_config.h",
because this file is compiled as part of tools/makefs.
--
Counting leap years was fine while we had 32bit time_t - but now it
is not a good idea for dates far away in the future.
For dates in the year 2000 or later, use arithmetic instead (since the
repeating periods are well aligned). Should fix PR 49144.
--
Avoid overflowing the "year" value by making the field uint64_t. Adapt
arguments and local variables accordingly.
This now fixes PR 49144 for real.
--
Adapt formats for debug printfs to clock_subr type changes.
 1.16.14.1  03-Dec-2017  jdolecek update from HEAD
 1.25.2.2  05-Oct-2016  skrll Sync with HEAD
 1.25.2.1  06-Apr-2015  skrll Sync with HEAD

RSS XML Feed