History log of /openbsd-current/bin/date/date.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.60 28-Apr-2024 florian

gmtime(3) / locatime(3) can fail when timestamps are way off.

Add missing error checks to all calls under bin/

Input & OK millert


Revision tags: OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE OPENBSD_7_5_BASE
# 1.59 23-Sep-2022 florian

Since tzset(3) ignores arbitrary files, we no longer need rpath
and can depend on the /usr/share/zoneinfo bypass.

OK mestre, millert, deraadt


# 1.58 19-Sep-2022 florian

When setting time, date(1) pledges "wpath" for logwtmp(3). Restrict
this using unveil(2), but ignore errors if /var/log doesn't exist. We
want to be able to set the time if the system is damanged or /var is
not mounted yet.
We also need to unveil everything for reading since we still allow
arbitrary locations of zone info files. Hopefully that will go away
soon.
OK deraadt


Revision tags: OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.57 11-Aug-2021 schwarze

If the -f argument includes %s, we need to use timegm(3) rather
than mktime(3) because the UNIX Epoch is defined in UTC rather than
in the local timezone.

Combining %s with other format specifiers is usually not useful.
But if a user does that, then parsing the whole input as UTC seems
better than parsing some of it as UTC and some of it in the local
time zone.

Bug found by Bryan Vyhmeister.
The final patch is joint work with and OK by gerhard@.
No objection when shown on tech@.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.56 08-Aug-2019 cheloha

date(1): remove -d dst and -t minutes_west

Part of the kernel timezone removal effort.

With input from deraadt@ and tedu@.

"burn it!" mpi@, ok tedu@ deraadt@


# 1.55 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_5_BASE
# 1.54 21-Jan-2019 tedu

add a -f pformat flag to parse the given time with strptime.


Revision tags: OPENBSD_6_4_BASE
# 1.53 25-Apr-2018 deraadt

The time-setting codepath can use pledge "settime" which was added for
ntpd, but apparently date was never revisited. "wpath" is for wtmp logging.
"rpath" for the case where -z argument isn't in the standard timezone dir.
discussed with tb and guenther


Revision tags: OPENBSD_6_3_BASE
# 1.52 13-Feb-2018 cheloha

atoll -> strtonum

ok millert@ tb@


# 1.51 23-Dec-2017 cheloha

As we only use the .tv_sec field, simplify gettimeofday(2) -> time(3).

While here, use err(3) instead of errx(3) if adjtime(2) fails.

Discussed/tweaked with/by tb@ and jca@.

ok tb@ jca@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.50 19-Oct-2016 schwarze

Delete useless setlocale(3) in src/bin/.
Minor cleanup while here: return from main, static void __dead usage, etc.
Based on a patch from Jan Stary <hans at stare dot cz>.
Feedback and OK tb@, OK millert@.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.49 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.48 07-Oct-2015 deraadt

tame "stdio rpath wpath". rpath is for localtime() and mktime(),
while wpath is for logwtmp(), a bit pessimistically since it is not clear
what could happen.
This is done AFTER the time is potentially set, since settimeofday() is
not available to us. Improvements and tests would be welcome.


Revision tags: OPENBSD_5_8_BASE
# 1.47 17-Apr-2015 deraadt

FALLTHROUGH in getopt is incorrect. While here use strtonum
to parse tz_minuteswest.
ok millert


# 1.46 17-Mar-2015 millert

Eliminate use of TM_YEAR_BASE. OK guenther@ deraadt@ miod@


# 1.45 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.44 07-Feb-2015 deraadt

When getopt processing flags, many should be flag=1 instead of flag++
ok tedu miod


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.43 21-Jan-2014 otto

localtime(3) can return NULL; seen by Rod Whitworth; ok guenther@


# 1.42 05-Jan-2014 schwarze

garbage collect unused global variable retval,
forgotten in rev. 1.36 when removing timed(8) support;
proofed by sobrado@


# 1.41 27-Nov-2013 okan

remove erroneous char cast to switch expression processing getopt(3);
not used in any cases.

ok deraadt@, guenther@, millert@


# 1.40 21-Nov-2013 deraadt

add unsigned char casts for specific calls to ctype.h macros.
ok guenther step


# 1.39 20-Oct-2013 guenther

Parse the argument the -r option with atoll() to support dates past 2038

from J Drivdal (xjd (at) rivu.net)


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.38 04-Dec-2012 deraadt

replace sys/param.h with sys/types.h (and sometimes add limits.h if needed)
ok guenther


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.37 08-Jul-2011 deraadt

extern.h no longer needed


# 1.36 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.35 11-Mar-2011 deraadt

Add a non-standard option that affects the output TZ only. The input (for
parsing) TZ is unaffected. This makes it it easier to convert timestamps
from any timezone to any other timezone -- no need for $() gymnastics
ok millert


# 1.34 11-Mar-2011 deraadt

Check that date(1) is not passed any extra arguments.
ok millert


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.33 31-Mar-2010 deraadt

Make a -DSMALL version of date(1) for the media


Revision tags: OPENBSD_4_7_BASE
# 1.32 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 28-Dec-2007 chl

printf field widths are always int, so add a cast to remove
"warning: field width is not type int"

"looks good" otto@


# 1.30 16-Oct-2007 sobrado

sync the synopsis and usage of commands

ok jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.29 25-May-2007 millert

Remove y2k hack. If no century is specified, use the current one.
OK otto@


# 1.28 12-Apr-2007 naddy

use UTC instead of GMT0 for -u; from Jared R.R.Spiegel <jrrs@ice-nine.org>
ok millert@, otto@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.27 29-Nov-2005 dhartmei

add an option -j which suppresses setting the clock, but parses the date
argument. useful to convert string-to-epoch (with +%s) or just to check
whether the argument is parsed correctly before really setting the clock.
ok millert@, deraadt@


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.26 15-Oct-2003 mpech

errx -> err. From form.

millert@ ok


Revision tags: OPENBSD_3_4_BASE
# 1.25 29-Jul-2003 deraadt

spacing


# 1.24 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.23 04-Jul-2002 deraadt

ansi


# 1.22 17-Apr-2002 deraadt

getopt idiot


Revision tags: OPENBSD_3_1_BASE
# 1.21 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.20 16-Jan-2002 mpech

missed some registers, kill'em!

millert@ ok


# 1.19 02-Dec-2001 deraadt

add -a to use adjtime(), like rdate(1) does


Revision tags: OPENBSD_3_0_BASE
# 1.18 06-Sep-2001 mpech

o) __progname aria;

millert@ ok.


Revision tags: OPENBSD_2_9_BASE
# 1.17 26-Mar-2001 millert

Fix comments, it is "daylight saving time", not "daylight savings time"


# 1.16 09-Nov-2000 aaron

Fix an off-by-one-hour error that would occur when changing the time across
DST (Daylight Saving Time); from NetBSD.


Revision tags: OPENBSD_2_8_BASE
# 1.15 15-Sep-2000 deraadt

check return value for setenv(3) for failure, and deal appropriately


Revision tags: OPENBSD_2_7_BASE
# 1.14 22-Jan-2000 deraadt

remove extra externs not needed because of unistd.h (rest of tree will be done later.. contact me if you want to help)


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.13 01-Feb-1999 d

GMT -> UTC in comments; make y2k hack easier to read


# 1.12 02-Jan-1999 weingart

Clean up some -Wall stuff, and a potential problem if TM_TIME_BASE was not
1900.


Revision tags: OPENBSD_2_4_BASE
# 1.11 01-Sep-1998 pjanzen

Clear up an overeager Y2K fix; be a little stricter with allowable times


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.10 17-Sep-1997 bri

Cosmetic:
Correct usage message.
Capitalize hours, minutes and seconds so that minutes are
distinguisable from months and so that things are in line
with strftime(3)


# 1.9 16-Sep-1997 deraadt

nicer spacing in usage


# 1.8 21-Aug-1997 deraadt

correct [yy]yy stuff in manpages and usage


# 1.7 23-Jul-1997 kstailey

tabify


# 1.6 23-Jun-1997 deraadt

duh, my mind is not crisp


# 1.5 23-Jun-1997 deraadt

yyyy specification code; m4@nts.umn.edu


Revision tags: OPENBSD_2_1_BASE
# 1.4 16-Apr-1997 deraadt

cleanup from danny@freebsd


# 1.3 04-Apr-1997 deraadt

wtmp repairs; netbsd


Revision tags: OPENBSD_2_0_BASE
# 1.2 23-Jun-1996 deraadt

update rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.59 23-Sep-2022 florian

Since tzset(3) ignores arbitrary files, we no longer need rpath
and can depend on the /usr/share/zoneinfo bypass.

OK mestre, millert, deraadt


# 1.58 19-Sep-2022 florian

When setting time, date(1) pledges "wpath" for logwtmp(3). Restrict
this using unveil(2), but ignore errors if /var/log doesn't exist. We
want to be able to set the time if the system is damanged or /var is
not mounted yet.
We also need to unveil everything for reading since we still allow
arbitrary locations of zone info files. Hopefully that will go away
soon.
OK deraadt


Revision tags: OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.57 11-Aug-2021 schwarze

If the -f argument includes %s, we need to use timegm(3) rather
than mktime(3) because the UNIX Epoch is defined in UTC rather than
in the local timezone.

Combining %s with other format specifiers is usually not useful.
But if a user does that, then parsing the whole input as UTC seems
better than parsing some of it as UTC and some of it in the local
time zone.

Bug found by Bryan Vyhmeister.
The final patch is joint work with and OK by gerhard@.
No objection when shown on tech@.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.56 08-Aug-2019 cheloha

date(1): remove -d dst and -t minutes_west

Part of the kernel timezone removal effort.

With input from deraadt@ and tedu@.

"burn it!" mpi@, ok tedu@ deraadt@


# 1.55 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_5_BASE
# 1.54 21-Jan-2019 tedu

add a -f pformat flag to parse the given time with strptime.


Revision tags: OPENBSD_6_4_BASE
# 1.53 25-Apr-2018 deraadt

The time-setting codepath can use pledge "settime" which was added for
ntpd, but apparently date was never revisited. "wpath" is for wtmp logging.
"rpath" for the case where -z argument isn't in the standard timezone dir.
discussed with tb and guenther


Revision tags: OPENBSD_6_3_BASE
# 1.52 13-Feb-2018 cheloha

atoll -> strtonum

ok millert@ tb@


# 1.51 23-Dec-2017 cheloha

As we only use the .tv_sec field, simplify gettimeofday(2) -> time(3).

While here, use err(3) instead of errx(3) if adjtime(2) fails.

Discussed/tweaked with/by tb@ and jca@.

ok tb@ jca@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.50 19-Oct-2016 schwarze

Delete useless setlocale(3) in src/bin/.
Minor cleanup while here: return from main, static void __dead usage, etc.
Based on a patch from Jan Stary <hans at stare dot cz>.
Feedback and OK tb@, OK millert@.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.49 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.48 07-Oct-2015 deraadt

tame "stdio rpath wpath". rpath is for localtime() and mktime(),
while wpath is for logwtmp(), a bit pessimistically since it is not clear
what could happen.
This is done AFTER the time is potentially set, since settimeofday() is
not available to us. Improvements and tests would be welcome.


Revision tags: OPENBSD_5_8_BASE
# 1.47 17-Apr-2015 deraadt

FALLTHROUGH in getopt is incorrect. While here use strtonum
to parse tz_minuteswest.
ok millert


# 1.46 17-Mar-2015 millert

Eliminate use of TM_YEAR_BASE. OK guenther@ deraadt@ miod@


# 1.45 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.44 07-Feb-2015 deraadt

When getopt processing flags, many should be flag=1 instead of flag++
ok tedu miod


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.43 21-Jan-2014 otto

localtime(3) can return NULL; seen by Rod Whitworth; ok guenther@


# 1.42 05-Jan-2014 schwarze

garbage collect unused global variable retval,
forgotten in rev. 1.36 when removing timed(8) support;
proofed by sobrado@


# 1.41 27-Nov-2013 okan

remove erroneous char cast to switch expression processing getopt(3);
not used in any cases.

ok deraadt@, guenther@, millert@


# 1.40 21-Nov-2013 deraadt

add unsigned char casts for specific calls to ctype.h macros.
ok guenther step


# 1.39 20-Oct-2013 guenther

Parse the argument the -r option with atoll() to support dates past 2038

from J Drivdal (xjd (at) rivu.net)


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.38 04-Dec-2012 deraadt

replace sys/param.h with sys/types.h (and sometimes add limits.h if needed)
ok guenther


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.37 08-Jul-2011 deraadt

extern.h no longer needed


# 1.36 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.35 11-Mar-2011 deraadt

Add a non-standard option that affects the output TZ only. The input (for
parsing) TZ is unaffected. This makes it it easier to convert timestamps
from any timezone to any other timezone -- no need for $() gymnastics
ok millert


# 1.34 11-Mar-2011 deraadt

Check that date(1) is not passed any extra arguments.
ok millert


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.33 31-Mar-2010 deraadt

Make a -DSMALL version of date(1) for the media


Revision tags: OPENBSD_4_7_BASE
# 1.32 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 28-Dec-2007 chl

printf field widths are always int, so add a cast to remove
"warning: field width is not type int"

"looks good" otto@


# 1.30 16-Oct-2007 sobrado

sync the synopsis and usage of commands

ok jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.29 25-May-2007 millert

Remove y2k hack. If no century is specified, use the current one.
OK otto@


# 1.28 12-Apr-2007 naddy

use UTC instead of GMT0 for -u; from Jared R.R.Spiegel <jrrs@ice-nine.org>
ok millert@, otto@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.27 29-Nov-2005 dhartmei

add an option -j which suppresses setting the clock, but parses the date
argument. useful to convert string-to-epoch (with +%s) or just to check
whether the argument is parsed correctly before really setting the clock.
ok millert@, deraadt@


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.26 15-Oct-2003 mpech

errx -> err. From form.

millert@ ok


Revision tags: OPENBSD_3_4_BASE
# 1.25 29-Jul-2003 deraadt

spacing


# 1.24 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.23 04-Jul-2002 deraadt

ansi


# 1.22 17-Apr-2002 deraadt

getopt idiot


Revision tags: OPENBSD_3_1_BASE
# 1.21 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.20 16-Jan-2002 mpech

missed some registers, kill'em!

millert@ ok


# 1.19 02-Dec-2001 deraadt

add -a to use adjtime(), like rdate(1) does


Revision tags: OPENBSD_3_0_BASE
# 1.18 06-Sep-2001 mpech

o) __progname aria;

millert@ ok.


Revision tags: OPENBSD_2_9_BASE
# 1.17 26-Mar-2001 millert

Fix comments, it is "daylight saving time", not "daylight savings time"


# 1.16 09-Nov-2000 aaron

Fix an off-by-one-hour error that would occur when changing the time across
DST (Daylight Saving Time); from NetBSD.


Revision tags: OPENBSD_2_8_BASE
# 1.15 15-Sep-2000 deraadt

check return value for setenv(3) for failure, and deal appropriately


Revision tags: OPENBSD_2_7_BASE
# 1.14 22-Jan-2000 deraadt

remove extra externs not needed because of unistd.h (rest of tree will be done later.. contact me if you want to help)


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.13 01-Feb-1999 d

GMT -> UTC in comments; make y2k hack easier to read


# 1.12 02-Jan-1999 weingart

Clean up some -Wall stuff, and a potential problem if TM_TIME_BASE was not
1900.


Revision tags: OPENBSD_2_4_BASE
# 1.11 01-Sep-1998 pjanzen

Clear up an overeager Y2K fix; be a little stricter with allowable times


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.10 17-Sep-1997 bri

Cosmetic:
Correct usage message.
Capitalize hours, minutes and seconds so that minutes are
distinguisable from months and so that things are in line
with strftime(3)


# 1.9 16-Sep-1997 deraadt

nicer spacing in usage


# 1.8 21-Aug-1997 deraadt

correct [yy]yy stuff in manpages and usage


# 1.7 23-Jul-1997 kstailey

tabify


# 1.6 23-Jun-1997 deraadt

duh, my mind is not crisp


# 1.5 23-Jun-1997 deraadt

yyyy specification code; m4@nts.umn.edu


Revision tags: OPENBSD_2_1_BASE
# 1.4 16-Apr-1997 deraadt

cleanup from danny@freebsd


# 1.3 04-Apr-1997 deraadt

wtmp repairs; netbsd


Revision tags: OPENBSD_2_0_BASE
# 1.2 23-Jun-1996 deraadt

update rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.58 19-Sep-2022 florian

When setting time, date(1) pledges "wpath" for logwtmp(3). Restrict
this using unveil(2), but ignore errors if /var/log doesn't exist. We
want to be able to set the time if the system is damanged or /var is
not mounted yet.
We also need to unveil everything for reading since we still allow
arbitrary locations of zone info files. Hopefully that will go away
soon.
OK deraadt


Revision tags: OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.57 11-Aug-2021 schwarze

If the -f argument includes %s, we need to use timegm(3) rather
than mktime(3) because the UNIX Epoch is defined in UTC rather than
in the local timezone.

Combining %s with other format specifiers is usually not useful.
But if a user does that, then parsing the whole input as UTC seems
better than parsing some of it as UTC and some of it in the local
time zone.

Bug found by Bryan Vyhmeister.
The final patch is joint work with and OK by gerhard@.
No objection when shown on tech@.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.56 08-Aug-2019 cheloha

date(1): remove -d dst and -t minutes_west

Part of the kernel timezone removal effort.

With input from deraadt@ and tedu@.

"burn it!" mpi@, ok tedu@ deraadt@


# 1.55 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_5_BASE
# 1.54 21-Jan-2019 tedu

add a -f pformat flag to parse the given time with strptime.


Revision tags: OPENBSD_6_4_BASE
# 1.53 25-Apr-2018 deraadt

The time-setting codepath can use pledge "settime" which was added for
ntpd, but apparently date was never revisited. "wpath" is for wtmp logging.
"rpath" for the case where -z argument isn't in the standard timezone dir.
discussed with tb and guenther


Revision tags: OPENBSD_6_3_BASE
# 1.52 13-Feb-2018 cheloha

atoll -> strtonum

ok millert@ tb@


# 1.51 23-Dec-2017 cheloha

As we only use the .tv_sec field, simplify gettimeofday(2) -> time(3).

While here, use err(3) instead of errx(3) if adjtime(2) fails.

Discussed/tweaked with/by tb@ and jca@.

ok tb@ jca@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.50 19-Oct-2016 schwarze

Delete useless setlocale(3) in src/bin/.
Minor cleanup while here: return from main, static void __dead usage, etc.
Based on a patch from Jan Stary <hans at stare dot cz>.
Feedback and OK tb@, OK millert@.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.49 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.48 07-Oct-2015 deraadt

tame "stdio rpath wpath". rpath is for localtime() and mktime(),
while wpath is for logwtmp(), a bit pessimistically since it is not clear
what could happen.
This is done AFTER the time is potentially set, since settimeofday() is
not available to us. Improvements and tests would be welcome.


Revision tags: OPENBSD_5_8_BASE
# 1.47 17-Apr-2015 deraadt

FALLTHROUGH in getopt is incorrect. While here use strtonum
to parse tz_minuteswest.
ok millert


# 1.46 17-Mar-2015 millert

Eliminate use of TM_YEAR_BASE. OK guenther@ deraadt@ miod@


# 1.45 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.44 07-Feb-2015 deraadt

When getopt processing flags, many should be flag=1 instead of flag++
ok tedu miod


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.43 21-Jan-2014 otto

localtime(3) can return NULL; seen by Rod Whitworth; ok guenther@


# 1.42 05-Jan-2014 schwarze

garbage collect unused global variable retval,
forgotten in rev. 1.36 when removing timed(8) support;
proofed by sobrado@


# 1.41 27-Nov-2013 okan

remove erroneous char cast to switch expression processing getopt(3);
not used in any cases.

ok deraadt@, guenther@, millert@


# 1.40 21-Nov-2013 deraadt

add unsigned char casts for specific calls to ctype.h macros.
ok guenther step


# 1.39 20-Oct-2013 guenther

Parse the argument the -r option with atoll() to support dates past 2038

from J Drivdal (xjd (at) rivu.net)


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.38 04-Dec-2012 deraadt

replace sys/param.h with sys/types.h (and sometimes add limits.h if needed)
ok guenther


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.37 08-Jul-2011 deraadt

extern.h no longer needed


# 1.36 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.35 11-Mar-2011 deraadt

Add a non-standard option that affects the output TZ only. The input (for
parsing) TZ is unaffected. This makes it it easier to convert timestamps
from any timezone to any other timezone -- no need for $() gymnastics
ok millert


# 1.34 11-Mar-2011 deraadt

Check that date(1) is not passed any extra arguments.
ok millert


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.33 31-Mar-2010 deraadt

Make a -DSMALL version of date(1) for the media


Revision tags: OPENBSD_4_7_BASE
# 1.32 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 28-Dec-2007 chl

printf field widths are always int, so add a cast to remove
"warning: field width is not type int"

"looks good" otto@


# 1.30 16-Oct-2007 sobrado

sync the synopsis and usage of commands

ok jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.29 25-May-2007 millert

Remove y2k hack. If no century is specified, use the current one.
OK otto@


# 1.28 12-Apr-2007 naddy

use UTC instead of GMT0 for -u; from Jared R.R.Spiegel <jrrs@ice-nine.org>
ok millert@, otto@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.27 29-Nov-2005 dhartmei

add an option -j which suppresses setting the clock, but parses the date
argument. useful to convert string-to-epoch (with +%s) or just to check
whether the argument is parsed correctly before really setting the clock.
ok millert@, deraadt@


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.26 15-Oct-2003 mpech

errx -> err. From form.

millert@ ok


Revision tags: OPENBSD_3_4_BASE
# 1.25 29-Jul-2003 deraadt

spacing


# 1.24 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.23 04-Jul-2002 deraadt

ansi


# 1.22 17-Apr-2002 deraadt

getopt idiot


Revision tags: OPENBSD_3_1_BASE
# 1.21 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.20 16-Jan-2002 mpech

missed some registers, kill'em!

millert@ ok


# 1.19 02-Dec-2001 deraadt

add -a to use adjtime(), like rdate(1) does


Revision tags: OPENBSD_3_0_BASE
# 1.18 06-Sep-2001 mpech

o) __progname aria;

millert@ ok.


Revision tags: OPENBSD_2_9_BASE
# 1.17 26-Mar-2001 millert

Fix comments, it is "daylight saving time", not "daylight savings time"


# 1.16 09-Nov-2000 aaron

Fix an off-by-one-hour error that would occur when changing the time across
DST (Daylight Saving Time); from NetBSD.


Revision tags: OPENBSD_2_8_BASE
# 1.15 15-Sep-2000 deraadt

check return value for setenv(3) for failure, and deal appropriately


Revision tags: OPENBSD_2_7_BASE
# 1.14 22-Jan-2000 deraadt

remove extra externs not needed because of unistd.h (rest of tree will be done later.. contact me if you want to help)


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.13 01-Feb-1999 d

GMT -> UTC in comments; make y2k hack easier to read


# 1.12 02-Jan-1999 weingart

Clean up some -Wall stuff, and a potential problem if TM_TIME_BASE was not
1900.


Revision tags: OPENBSD_2_4_BASE
# 1.11 01-Sep-1998 pjanzen

Clear up an overeager Y2K fix; be a little stricter with allowable times


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.10 17-Sep-1997 bri

Cosmetic:
Correct usage message.
Capitalize hours, minutes and seconds so that minutes are
distinguisable from months and so that things are in line
with strftime(3)


# 1.9 16-Sep-1997 deraadt

nicer spacing in usage


# 1.8 21-Aug-1997 deraadt

correct [yy]yy stuff in manpages and usage


# 1.7 23-Jul-1997 kstailey

tabify


# 1.6 23-Jun-1997 deraadt

duh, my mind is not crisp


# 1.5 23-Jun-1997 deraadt

yyyy specification code; m4@nts.umn.edu


Revision tags: OPENBSD_2_1_BASE
# 1.4 16-Apr-1997 deraadt

cleanup from danny@freebsd


# 1.3 04-Apr-1997 deraadt

wtmp repairs; netbsd


Revision tags: OPENBSD_2_0_BASE
# 1.2 23-Jun-1996 deraadt

update rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.57 11-Aug-2021 schwarze

If the -f argument includes %s, we need to use timegm(3) rather
than mktime(3) because the UNIX Epoch is defined in UTC rather than
in the local timezone.

Combining %s with other format specifiers is usually not useful.
But if a user does that, then parsing the whole input as UTC seems
better than parsing some of it as UTC and some of it in the local
time zone.

Bug found by Bryan Vyhmeister.
The final patch is joint work with and OK by gerhard@.
No objection when shown on tech@.


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.56 08-Aug-2019 cheloha

date(1): remove -d dst and -t minutes_west

Part of the kernel timezone removal effort.

With input from deraadt@ and tedu@.

"burn it!" mpi@, ok tedu@ deraadt@


# 1.55 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_5_BASE
# 1.54 21-Jan-2019 tedu

add a -f pformat flag to parse the given time with strptime.


Revision tags: OPENBSD_6_4_BASE
# 1.53 25-Apr-2018 deraadt

The time-setting codepath can use pledge "settime" which was added for
ntpd, but apparently date was never revisited. "wpath" is for wtmp logging.
"rpath" for the case where -z argument isn't in the standard timezone dir.
discussed with tb and guenther


Revision tags: OPENBSD_6_3_BASE
# 1.52 13-Feb-2018 cheloha

atoll -> strtonum

ok millert@ tb@


# 1.51 23-Dec-2017 cheloha

As we only use the .tv_sec field, simplify gettimeofday(2) -> time(3).

While here, use err(3) instead of errx(3) if adjtime(2) fails.

Discussed/tweaked with/by tb@ and jca@.

ok tb@ jca@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.50 19-Oct-2016 schwarze

Delete useless setlocale(3) in src/bin/.
Minor cleanup while here: return from main, static void __dead usage, etc.
Based on a patch from Jan Stary <hans at stare dot cz>.
Feedback and OK tb@, OK millert@.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.49 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.48 07-Oct-2015 deraadt

tame "stdio rpath wpath". rpath is for localtime() and mktime(),
while wpath is for logwtmp(), a bit pessimistically since it is not clear
what could happen.
This is done AFTER the time is potentially set, since settimeofday() is
not available to us. Improvements and tests would be welcome.


Revision tags: OPENBSD_5_8_BASE
# 1.47 17-Apr-2015 deraadt

FALLTHROUGH in getopt is incorrect. While here use strtonum
to parse tz_minuteswest.
ok millert


# 1.46 17-Mar-2015 millert

Eliminate use of TM_YEAR_BASE. OK guenther@ deraadt@ miod@


# 1.45 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.44 07-Feb-2015 deraadt

When getopt processing flags, many should be flag=1 instead of flag++
ok tedu miod


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.43 21-Jan-2014 otto

localtime(3) can return NULL; seen by Rod Whitworth; ok guenther@


# 1.42 05-Jan-2014 schwarze

garbage collect unused global variable retval,
forgotten in rev. 1.36 when removing timed(8) support;
proofed by sobrado@


# 1.41 27-Nov-2013 okan

remove erroneous char cast to switch expression processing getopt(3);
not used in any cases.

ok deraadt@, guenther@, millert@


# 1.40 21-Nov-2013 deraadt

add unsigned char casts for specific calls to ctype.h macros.
ok guenther step


# 1.39 20-Oct-2013 guenther

Parse the argument the -r option with atoll() to support dates past 2038

from J Drivdal (xjd (at) rivu.net)


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.38 04-Dec-2012 deraadt

replace sys/param.h with sys/types.h (and sometimes add limits.h if needed)
ok guenther


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.37 08-Jul-2011 deraadt

extern.h no longer needed


# 1.36 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.35 11-Mar-2011 deraadt

Add a non-standard option that affects the output TZ only. The input (for
parsing) TZ is unaffected. This makes it it easier to convert timestamps
from any timezone to any other timezone -- no need for $() gymnastics
ok millert


# 1.34 11-Mar-2011 deraadt

Check that date(1) is not passed any extra arguments.
ok millert


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.33 31-Mar-2010 deraadt

Make a -DSMALL version of date(1) for the media


Revision tags: OPENBSD_4_7_BASE
# 1.32 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 28-Dec-2007 chl

printf field widths are always int, so add a cast to remove
"warning: field width is not type int"

"looks good" otto@


# 1.30 16-Oct-2007 sobrado

sync the synopsis and usage of commands

ok jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.29 25-May-2007 millert

Remove y2k hack. If no century is specified, use the current one.
OK otto@


# 1.28 12-Apr-2007 naddy

use UTC instead of GMT0 for -u; from Jared R.R.Spiegel <jrrs@ice-nine.org>
ok millert@, otto@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.27 29-Nov-2005 dhartmei

add an option -j which suppresses setting the clock, but parses the date
argument. useful to convert string-to-epoch (with +%s) or just to check
whether the argument is parsed correctly before really setting the clock.
ok millert@, deraadt@


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.26 15-Oct-2003 mpech

errx -> err. From form.

millert@ ok


Revision tags: OPENBSD_3_4_BASE
# 1.25 29-Jul-2003 deraadt

spacing


# 1.24 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.23 04-Jul-2002 deraadt

ansi


# 1.22 17-Apr-2002 deraadt

getopt idiot


Revision tags: OPENBSD_3_1_BASE
# 1.21 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.20 16-Jan-2002 mpech

missed some registers, kill'em!

millert@ ok


# 1.19 02-Dec-2001 deraadt

add -a to use adjtime(), like rdate(1) does


Revision tags: OPENBSD_3_0_BASE
# 1.18 06-Sep-2001 mpech

o) __progname aria;

millert@ ok.


Revision tags: OPENBSD_2_9_BASE
# 1.17 26-Mar-2001 millert

Fix comments, it is "daylight saving time", not "daylight savings time"


# 1.16 09-Nov-2000 aaron

Fix an off-by-one-hour error that would occur when changing the time across
DST (Daylight Saving Time); from NetBSD.


Revision tags: OPENBSD_2_8_BASE
# 1.15 15-Sep-2000 deraadt

check return value for setenv(3) for failure, and deal appropriately


Revision tags: OPENBSD_2_7_BASE
# 1.14 22-Jan-2000 deraadt

remove extra externs not needed because of unistd.h (rest of tree will be done later.. contact me if you want to help)


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.13 01-Feb-1999 d

GMT -> UTC in comments; make y2k hack easier to read


# 1.12 02-Jan-1999 weingart

Clean up some -Wall stuff, and a potential problem if TM_TIME_BASE was not
1900.


Revision tags: OPENBSD_2_4_BASE
# 1.11 01-Sep-1998 pjanzen

Clear up an overeager Y2K fix; be a little stricter with allowable times


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.10 17-Sep-1997 bri

Cosmetic:
Correct usage message.
Capitalize hours, minutes and seconds so that minutes are
distinguisable from months and so that things are in line
with strftime(3)


# 1.9 16-Sep-1997 deraadt

nicer spacing in usage


# 1.8 21-Aug-1997 deraadt

correct [yy]yy stuff in manpages and usage


# 1.7 23-Jul-1997 kstailey

tabify


# 1.6 23-Jun-1997 deraadt

duh, my mind is not crisp


# 1.5 23-Jun-1997 deraadt

yyyy specification code; m4@nts.umn.edu


Revision tags: OPENBSD_2_1_BASE
# 1.4 16-Apr-1997 deraadt

cleanup from danny@freebsd


# 1.3 04-Apr-1997 deraadt

wtmp repairs; netbsd


Revision tags: OPENBSD_2_0_BASE
# 1.2 23-Jun-1996 deraadt

update rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.56 08-Aug-2019 cheloha

date(1): remove -d dst and -t minutes_west

Part of the kernel timezone removal effort.

With input from deraadt@ and tedu@.

"burn it!" mpi@, ok tedu@ deraadt@


# 1.55 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_5_BASE
# 1.54 21-Jan-2019 tedu

add a -f pformat flag to parse the given time with strptime.


Revision tags: OPENBSD_6_4_BASE
# 1.53 25-Apr-2018 deraadt

The time-setting codepath can use pledge "settime" which was added for
ntpd, but apparently date was never revisited. "wpath" is for wtmp logging.
"rpath" for the case where -z argument isn't in the standard timezone dir.
discussed with tb and guenther


Revision tags: OPENBSD_6_3_BASE
# 1.52 13-Feb-2018 cheloha

atoll -> strtonum

ok millert@ tb@


# 1.51 23-Dec-2017 cheloha

As we only use the .tv_sec field, simplify gettimeofday(2) -> time(3).

While here, use err(3) instead of errx(3) if adjtime(2) fails.

Discussed/tweaked with/by tb@ and jca@.

ok tb@ jca@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.50 19-Oct-2016 schwarze

Delete useless setlocale(3) in src/bin/.
Minor cleanup while here: return from main, static void __dead usage, etc.
Based on a patch from Jan Stary <hans at stare dot cz>.
Feedback and OK tb@, OK millert@.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.49 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.48 07-Oct-2015 deraadt

tame "stdio rpath wpath". rpath is for localtime() and mktime(),
while wpath is for logwtmp(), a bit pessimistically since it is not clear
what could happen.
This is done AFTER the time is potentially set, since settimeofday() is
not available to us. Improvements and tests would be welcome.


Revision tags: OPENBSD_5_8_BASE
# 1.47 17-Apr-2015 deraadt

FALLTHROUGH in getopt is incorrect. While here use strtonum
to parse tz_minuteswest.
ok millert


# 1.46 17-Mar-2015 millert

Eliminate use of TM_YEAR_BASE. OK guenther@ deraadt@ miod@


# 1.45 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.44 07-Feb-2015 deraadt

When getopt processing flags, many should be flag=1 instead of flag++
ok tedu miod


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.43 21-Jan-2014 otto

localtime(3) can return NULL; seen by Rod Whitworth; ok guenther@


# 1.42 05-Jan-2014 schwarze

garbage collect unused global variable retval,
forgotten in rev. 1.36 when removing timed(8) support;
proofed by sobrado@


# 1.41 27-Nov-2013 okan

remove erroneous char cast to switch expression processing getopt(3);
not used in any cases.

ok deraadt@, guenther@, millert@


# 1.40 21-Nov-2013 deraadt

add unsigned char casts for specific calls to ctype.h macros.
ok guenther step


# 1.39 20-Oct-2013 guenther

Parse the argument the -r option with atoll() to support dates past 2038

from J Drivdal (xjd (at) rivu.net)


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.38 04-Dec-2012 deraadt

replace sys/param.h with sys/types.h (and sometimes add limits.h if needed)
ok guenther


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.37 08-Jul-2011 deraadt

extern.h no longer needed


# 1.36 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.35 11-Mar-2011 deraadt

Add a non-standard option that affects the output TZ only. The input (for
parsing) TZ is unaffected. This makes it it easier to convert timestamps
from any timezone to any other timezone -- no need for $() gymnastics
ok millert


# 1.34 11-Mar-2011 deraadt

Check that date(1) is not passed any extra arguments.
ok millert


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.33 31-Mar-2010 deraadt

Make a -DSMALL version of date(1) for the media


Revision tags: OPENBSD_4_7_BASE
# 1.32 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 28-Dec-2007 chl

printf field widths are always int, so add a cast to remove
"warning: field width is not type int"

"looks good" otto@


# 1.30 16-Oct-2007 sobrado

sync the synopsis and usage of commands

ok jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.29 25-May-2007 millert

Remove y2k hack. If no century is specified, use the current one.
OK otto@


# 1.28 12-Apr-2007 naddy

use UTC instead of GMT0 for -u; from Jared R.R.Spiegel <jrrs@ice-nine.org>
ok millert@, otto@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.27 29-Nov-2005 dhartmei

add an option -j which suppresses setting the clock, but parses the date
argument. useful to convert string-to-epoch (with +%s) or just to check
whether the argument is parsed correctly before really setting the clock.
ok millert@, deraadt@


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.26 15-Oct-2003 mpech

errx -> err. From form.

millert@ ok


Revision tags: OPENBSD_3_4_BASE
# 1.25 29-Jul-2003 deraadt

spacing


# 1.24 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.23 04-Jul-2002 deraadt

ansi


# 1.22 17-Apr-2002 deraadt

getopt idiot


Revision tags: OPENBSD_3_1_BASE
# 1.21 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.20 16-Jan-2002 mpech

missed some registers, kill'em!

millert@ ok


# 1.19 02-Dec-2001 deraadt

add -a to use adjtime(), like rdate(1) does


Revision tags: OPENBSD_3_0_BASE
# 1.18 06-Sep-2001 mpech

o) __progname aria;

millert@ ok.


Revision tags: OPENBSD_2_9_BASE
# 1.17 26-Mar-2001 millert

Fix comments, it is "daylight saving time", not "daylight savings time"


# 1.16 09-Nov-2000 aaron

Fix an off-by-one-hour error that would occur when changing the time across
DST (Daylight Saving Time); from NetBSD.


Revision tags: OPENBSD_2_8_BASE
# 1.15 15-Sep-2000 deraadt

check return value for setenv(3) for failure, and deal appropriately


Revision tags: OPENBSD_2_7_BASE
# 1.14 22-Jan-2000 deraadt

remove extra externs not needed because of unistd.h (rest of tree will be done later.. contact me if you want to help)


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.13 01-Feb-1999 d

GMT -> UTC in comments; make y2k hack easier to read


# 1.12 02-Jan-1999 weingart

Clean up some -Wall stuff, and a potential problem if TM_TIME_BASE was not
1900.


Revision tags: OPENBSD_2_4_BASE
# 1.11 01-Sep-1998 pjanzen

Clear up an overeager Y2K fix; be a little stricter with allowable times


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.10 17-Sep-1997 bri

Cosmetic:
Correct usage message.
Capitalize hours, minutes and seconds so that minutes are
distinguisable from months and so that things are in line
with strftime(3)


# 1.9 16-Sep-1997 deraadt

nicer spacing in usage


# 1.8 21-Aug-1997 deraadt

correct [yy]yy stuff in manpages and usage


# 1.7 23-Jul-1997 kstailey

tabify


# 1.6 23-Jun-1997 deraadt

duh, my mind is not crisp


# 1.5 23-Jun-1997 deraadt

yyyy specification code; m4@nts.umn.edu


Revision tags: OPENBSD_2_1_BASE
# 1.4 16-Apr-1997 deraadt

cleanup from danny@freebsd


# 1.3 04-Apr-1997 deraadt

wtmp repairs; netbsd


Revision tags: OPENBSD_2_0_BASE
# 1.2 23-Jun-1996 deraadt

update rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.55 28-Jun-2019 deraadt

When system calls indicate an error they return -1, not some arbitrary
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.


Revision tags: OPENBSD_6_5_BASE
# 1.54 21-Jan-2019 tedu

add a -f pformat flag to parse the given time with strptime.


Revision tags: OPENBSD_6_4_BASE
# 1.53 25-Apr-2018 deraadt

The time-setting codepath can use pledge "settime" which was added for
ntpd, but apparently date was never revisited. "wpath" is for wtmp logging.
"rpath" for the case where -z argument isn't in the standard timezone dir.
discussed with tb and guenther


Revision tags: OPENBSD_6_3_BASE
# 1.52 13-Feb-2018 cheloha

atoll -> strtonum

ok millert@ tb@


# 1.51 23-Dec-2017 cheloha

As we only use the .tv_sec field, simplify gettimeofday(2) -> time(3).

While here, use err(3) instead of errx(3) if adjtime(2) fails.

Discussed/tweaked with/by tb@ and jca@.

ok tb@ jca@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.50 19-Oct-2016 schwarze

Delete useless setlocale(3) in src/bin/.
Minor cleanup while here: return from main, static void __dead usage, etc.
Based on a patch from Jan Stary <hans at stare dot cz>.
Feedback and OK tb@, OK millert@.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.49 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.48 07-Oct-2015 deraadt

tame "stdio rpath wpath". rpath is for localtime() and mktime(),
while wpath is for logwtmp(), a bit pessimistically since it is not clear
what could happen.
This is done AFTER the time is potentially set, since settimeofday() is
not available to us. Improvements and tests would be welcome.


Revision tags: OPENBSD_5_8_BASE
# 1.47 17-Apr-2015 deraadt

FALLTHROUGH in getopt is incorrect. While here use strtonum
to parse tz_minuteswest.
ok millert


# 1.46 17-Mar-2015 millert

Eliminate use of TM_YEAR_BASE. OK guenther@ deraadt@ miod@


# 1.45 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.44 07-Feb-2015 deraadt

When getopt processing flags, many should be flag=1 instead of flag++
ok tedu miod


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.43 21-Jan-2014 otto

localtime(3) can return NULL; seen by Rod Whitworth; ok guenther@


# 1.42 05-Jan-2014 schwarze

garbage collect unused global variable retval,
forgotten in rev. 1.36 when removing timed(8) support;
proofed by sobrado@


# 1.41 27-Nov-2013 okan

remove erroneous char cast to switch expression processing getopt(3);
not used in any cases.

ok deraadt@, guenther@, millert@


# 1.40 21-Nov-2013 deraadt

add unsigned char casts for specific calls to ctype.h macros.
ok guenther step


# 1.39 20-Oct-2013 guenther

Parse the argument the -r option with atoll() to support dates past 2038

from J Drivdal (xjd (at) rivu.net)


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.38 04-Dec-2012 deraadt

replace sys/param.h with sys/types.h (and sometimes add limits.h if needed)
ok guenther


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.37 08-Jul-2011 deraadt

extern.h no longer needed


# 1.36 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.35 11-Mar-2011 deraadt

Add a non-standard option that affects the output TZ only. The input (for
parsing) TZ is unaffected. This makes it it easier to convert timestamps
from any timezone to any other timezone -- no need for $() gymnastics
ok millert


# 1.34 11-Mar-2011 deraadt

Check that date(1) is not passed any extra arguments.
ok millert


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.33 31-Mar-2010 deraadt

Make a -DSMALL version of date(1) for the media


Revision tags: OPENBSD_4_7_BASE
# 1.32 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 28-Dec-2007 chl

printf field widths are always int, so add a cast to remove
"warning: field width is not type int"

"looks good" otto@


# 1.30 16-Oct-2007 sobrado

sync the synopsis and usage of commands

ok jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.29 25-May-2007 millert

Remove y2k hack. If no century is specified, use the current one.
OK otto@


# 1.28 12-Apr-2007 naddy

use UTC instead of GMT0 for -u; from Jared R.R.Spiegel <jrrs@ice-nine.org>
ok millert@, otto@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.27 29-Nov-2005 dhartmei

add an option -j which suppresses setting the clock, but parses the date
argument. useful to convert string-to-epoch (with +%s) or just to check
whether the argument is parsed correctly before really setting the clock.
ok millert@, deraadt@


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.26 15-Oct-2003 mpech

errx -> err. From form.

millert@ ok


Revision tags: OPENBSD_3_4_BASE
# 1.25 29-Jul-2003 deraadt

spacing


# 1.24 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.23 04-Jul-2002 deraadt

ansi


# 1.22 17-Apr-2002 deraadt

getopt idiot


Revision tags: OPENBSD_3_1_BASE
# 1.21 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.20 16-Jan-2002 mpech

missed some registers, kill'em!

millert@ ok


# 1.19 02-Dec-2001 deraadt

add -a to use adjtime(), like rdate(1) does


Revision tags: OPENBSD_3_0_BASE
# 1.18 06-Sep-2001 mpech

o) __progname aria;

millert@ ok.


Revision tags: OPENBSD_2_9_BASE
# 1.17 26-Mar-2001 millert

Fix comments, it is "daylight saving time", not "daylight savings time"


# 1.16 09-Nov-2000 aaron

Fix an off-by-one-hour error that would occur when changing the time across
DST (Daylight Saving Time); from NetBSD.


Revision tags: OPENBSD_2_8_BASE
# 1.15 15-Sep-2000 deraadt

check return value for setenv(3) for failure, and deal appropriately


Revision tags: OPENBSD_2_7_BASE
# 1.14 22-Jan-2000 deraadt

remove extra externs not needed because of unistd.h (rest of tree will be done later.. contact me if you want to help)


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.13 01-Feb-1999 d

GMT -> UTC in comments; make y2k hack easier to read


# 1.12 02-Jan-1999 weingart

Clean up some -Wall stuff, and a potential problem if TM_TIME_BASE was not
1900.


Revision tags: OPENBSD_2_4_BASE
# 1.11 01-Sep-1998 pjanzen

Clear up an overeager Y2K fix; be a little stricter with allowable times


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.10 17-Sep-1997 bri

Cosmetic:
Correct usage message.
Capitalize hours, minutes and seconds so that minutes are
distinguisable from months and so that things are in line
with strftime(3)


# 1.9 16-Sep-1997 deraadt

nicer spacing in usage


# 1.8 21-Aug-1997 deraadt

correct [yy]yy stuff in manpages and usage


# 1.7 23-Jul-1997 kstailey

tabify


# 1.6 23-Jun-1997 deraadt

duh, my mind is not crisp


# 1.5 23-Jun-1997 deraadt

yyyy specification code; m4@nts.umn.edu


Revision tags: OPENBSD_2_1_BASE
# 1.4 16-Apr-1997 deraadt

cleanup from danny@freebsd


# 1.3 04-Apr-1997 deraadt

wtmp repairs; netbsd


Revision tags: OPENBSD_2_0_BASE
# 1.2 23-Jun-1996 deraadt

update rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.54 21-Jan-2019 tedu

add a -f pformat flag to parse the given time with strptime.


Revision tags: OPENBSD_6_4_BASE
# 1.53 25-Apr-2018 deraadt

The time-setting codepath can use pledge "settime" which was added for
ntpd, but apparently date was never revisited. "wpath" is for wtmp logging.
"rpath" for the case where -z argument isn't in the standard timezone dir.
discussed with tb and guenther


Revision tags: OPENBSD_6_3_BASE
# 1.52 13-Feb-2018 cheloha

atoll -> strtonum

ok millert@ tb@


# 1.51 23-Dec-2017 cheloha

As we only use the .tv_sec field, simplify gettimeofday(2) -> time(3).

While here, use err(3) instead of errx(3) if adjtime(2) fails.

Discussed/tweaked with/by tb@ and jca@.

ok tb@ jca@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.50 19-Oct-2016 schwarze

Delete useless setlocale(3) in src/bin/.
Minor cleanup while here: return from main, static void __dead usage, etc.
Based on a patch from Jan Stary <hans at stare dot cz>.
Feedback and OK tb@, OK millert@.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.49 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.48 07-Oct-2015 deraadt

tame "stdio rpath wpath". rpath is for localtime() and mktime(),
while wpath is for logwtmp(), a bit pessimistically since it is not clear
what could happen.
This is done AFTER the time is potentially set, since settimeofday() is
not available to us. Improvements and tests would be welcome.


Revision tags: OPENBSD_5_8_BASE
# 1.47 17-Apr-2015 deraadt

FALLTHROUGH in getopt is incorrect. While here use strtonum
to parse tz_minuteswest.
ok millert


# 1.46 17-Mar-2015 millert

Eliminate use of TM_YEAR_BASE. OK guenther@ deraadt@ miod@


# 1.45 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.44 07-Feb-2015 deraadt

When getopt processing flags, many should be flag=1 instead of flag++
ok tedu miod


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.43 21-Jan-2014 otto

localtime(3) can return NULL; seen by Rod Whitworth; ok guenther@


# 1.42 05-Jan-2014 schwarze

garbage collect unused global variable retval,
forgotten in rev. 1.36 when removing timed(8) support;
proofed by sobrado@


# 1.41 27-Nov-2013 okan

remove erroneous char cast to switch expression processing getopt(3);
not used in any cases.

ok deraadt@, guenther@, millert@


# 1.40 21-Nov-2013 deraadt

add unsigned char casts for specific calls to ctype.h macros.
ok guenther step


# 1.39 20-Oct-2013 guenther

Parse the argument the -r option with atoll() to support dates past 2038

from J Drivdal (xjd (at) rivu.net)


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.38 04-Dec-2012 deraadt

replace sys/param.h with sys/types.h (and sometimes add limits.h if needed)
ok guenther


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.37 08-Jul-2011 deraadt

extern.h no longer needed


# 1.36 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.35 11-Mar-2011 deraadt

Add a non-standard option that affects the output TZ only. The input (for
parsing) TZ is unaffected. This makes it it easier to convert timestamps
from any timezone to any other timezone -- no need for $() gymnastics
ok millert


# 1.34 11-Mar-2011 deraadt

Check that date(1) is not passed any extra arguments.
ok millert


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.33 31-Mar-2010 deraadt

Make a -DSMALL version of date(1) for the media


Revision tags: OPENBSD_4_7_BASE
# 1.32 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 28-Dec-2007 chl

printf field widths are always int, so add a cast to remove
"warning: field width is not type int"

"looks good" otto@


# 1.30 16-Oct-2007 sobrado

sync the synopsis and usage of commands

ok jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.29 25-May-2007 millert

Remove y2k hack. If no century is specified, use the current one.
OK otto@


# 1.28 12-Apr-2007 naddy

use UTC instead of GMT0 for -u; from Jared R.R.Spiegel <jrrs@ice-nine.org>
ok millert@, otto@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.27 29-Nov-2005 dhartmei

add an option -j which suppresses setting the clock, but parses the date
argument. useful to convert string-to-epoch (with +%s) or just to check
whether the argument is parsed correctly before really setting the clock.
ok millert@, deraadt@


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.26 15-Oct-2003 mpech

errx -> err. From form.

millert@ ok


Revision tags: OPENBSD_3_4_BASE
# 1.25 29-Jul-2003 deraadt

spacing


# 1.24 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.23 04-Jul-2002 deraadt

ansi


# 1.22 17-Apr-2002 deraadt

getopt idiot


Revision tags: OPENBSD_3_1_BASE
# 1.21 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.20 16-Jan-2002 mpech

missed some registers, kill'em!

millert@ ok


# 1.19 02-Dec-2001 deraadt

add -a to use adjtime(), like rdate(1) does


Revision tags: OPENBSD_3_0_BASE
# 1.18 06-Sep-2001 mpech

o) __progname aria;

millert@ ok.


Revision tags: OPENBSD_2_9_BASE
# 1.17 26-Mar-2001 millert

Fix comments, it is "daylight saving time", not "daylight savings time"


# 1.16 09-Nov-2000 aaron

Fix an off-by-one-hour error that would occur when changing the time across
DST (Daylight Saving Time); from NetBSD.


Revision tags: OPENBSD_2_8_BASE
# 1.15 15-Sep-2000 deraadt

check return value for setenv(3) for failure, and deal appropriately


Revision tags: OPENBSD_2_7_BASE
# 1.14 22-Jan-2000 deraadt

remove extra externs not needed because of unistd.h (rest of tree will be done later.. contact me if you want to help)


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.13 01-Feb-1999 d

GMT -> UTC in comments; make y2k hack easier to read


# 1.12 02-Jan-1999 weingart

Clean up some -Wall stuff, and a potential problem if TM_TIME_BASE was not
1900.


Revision tags: OPENBSD_2_4_BASE
# 1.11 01-Sep-1998 pjanzen

Clear up an overeager Y2K fix; be a little stricter with allowable times


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.10 17-Sep-1997 bri

Cosmetic:
Correct usage message.
Capitalize hours, minutes and seconds so that minutes are
distinguisable from months and so that things are in line
with strftime(3)


# 1.9 16-Sep-1997 deraadt

nicer spacing in usage


# 1.8 21-Aug-1997 deraadt

correct [yy]yy stuff in manpages and usage


# 1.7 23-Jul-1997 kstailey

tabify


# 1.6 23-Jun-1997 deraadt

duh, my mind is not crisp


# 1.5 23-Jun-1997 deraadt

yyyy specification code; m4@nts.umn.edu


Revision tags: OPENBSD_2_1_BASE
# 1.4 16-Apr-1997 deraadt

cleanup from danny@freebsd


# 1.3 04-Apr-1997 deraadt

wtmp repairs; netbsd


Revision tags: OPENBSD_2_0_BASE
# 1.2 23-Jun-1996 deraadt

update rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.53 25-Apr-2018 deraadt

The time-setting codepath can use pledge "settime" which was added for
ntpd, but apparently date was never revisited. "wpath" is for wtmp logging.
"rpath" for the case where -z argument isn't in the standard timezone dir.
discussed with tb and guenther


Revision tags: OPENBSD_6_3_BASE
# 1.52 13-Feb-2018 cheloha

atoll -> strtonum

ok millert@ tb@


# 1.51 23-Dec-2017 cheloha

As we only use the .tv_sec field, simplify gettimeofday(2) -> time(3).

While here, use err(3) instead of errx(3) if adjtime(2) fails.

Discussed/tweaked with/by tb@ and jca@.

ok tb@ jca@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.50 19-Oct-2016 schwarze

Delete useless setlocale(3) in src/bin/.
Minor cleanup while here: return from main, static void __dead usage, etc.
Based on a patch from Jan Stary <hans at stare dot cz>.
Feedback and OK tb@, OK millert@.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.49 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.48 07-Oct-2015 deraadt

tame "stdio rpath wpath". rpath is for localtime() and mktime(),
while wpath is for logwtmp(), a bit pessimistically since it is not clear
what could happen.
This is done AFTER the time is potentially set, since settimeofday() is
not available to us. Improvements and tests would be welcome.


Revision tags: OPENBSD_5_8_BASE
# 1.47 17-Apr-2015 deraadt

FALLTHROUGH in getopt is incorrect. While here use strtonum
to parse tz_minuteswest.
ok millert


# 1.46 17-Mar-2015 millert

Eliminate use of TM_YEAR_BASE. OK guenther@ deraadt@ miod@


# 1.45 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.44 07-Feb-2015 deraadt

When getopt processing flags, many should be flag=1 instead of flag++
ok tedu miod


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.43 21-Jan-2014 otto

localtime(3) can return NULL; seen by Rod Whitworth; ok guenther@


# 1.42 05-Jan-2014 schwarze

garbage collect unused global variable retval,
forgotten in rev. 1.36 when removing timed(8) support;
proofed by sobrado@


# 1.41 27-Nov-2013 okan

remove erroneous char cast to switch expression processing getopt(3);
not used in any cases.

ok deraadt@, guenther@, millert@


# 1.40 21-Nov-2013 deraadt

add unsigned char casts for specific calls to ctype.h macros.
ok guenther step


# 1.39 20-Oct-2013 guenther

Parse the argument the -r option with atoll() to support dates past 2038

from J Drivdal (xjd (at) rivu.net)


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.38 04-Dec-2012 deraadt

replace sys/param.h with sys/types.h (and sometimes add limits.h if needed)
ok guenther


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.37 08-Jul-2011 deraadt

extern.h no longer needed


# 1.36 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.35 11-Mar-2011 deraadt

Add a non-standard option that affects the output TZ only. The input (for
parsing) TZ is unaffected. This makes it it easier to convert timestamps
from any timezone to any other timezone -- no need for $() gymnastics
ok millert


# 1.34 11-Mar-2011 deraadt

Check that date(1) is not passed any extra arguments.
ok millert


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.33 31-Mar-2010 deraadt

Make a -DSMALL version of date(1) for the media


Revision tags: OPENBSD_4_7_BASE
# 1.32 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 28-Dec-2007 chl

printf field widths are always int, so add a cast to remove
"warning: field width is not type int"

"looks good" otto@


# 1.30 16-Oct-2007 sobrado

sync the synopsis and usage of commands

ok jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.29 25-May-2007 millert

Remove y2k hack. If no century is specified, use the current one.
OK otto@


# 1.28 12-Apr-2007 naddy

use UTC instead of GMT0 for -u; from Jared R.R.Spiegel <jrrs@ice-nine.org>
ok millert@, otto@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.27 29-Nov-2005 dhartmei

add an option -j which suppresses setting the clock, but parses the date
argument. useful to convert string-to-epoch (with +%s) or just to check
whether the argument is parsed correctly before really setting the clock.
ok millert@, deraadt@


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.26 15-Oct-2003 mpech

errx -> err. From form.

millert@ ok


Revision tags: OPENBSD_3_4_BASE
# 1.25 29-Jul-2003 deraadt

spacing


# 1.24 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.23 04-Jul-2002 deraadt

ansi


# 1.22 17-Apr-2002 deraadt

getopt idiot


Revision tags: OPENBSD_3_1_BASE
# 1.21 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.20 16-Jan-2002 mpech

missed some registers, kill'em!

millert@ ok


# 1.19 02-Dec-2001 deraadt

add -a to use adjtime(), like rdate(1) does


Revision tags: OPENBSD_3_0_BASE
# 1.18 06-Sep-2001 mpech

o) __progname aria;

millert@ ok.


Revision tags: OPENBSD_2_9_BASE
# 1.17 26-Mar-2001 millert

Fix comments, it is "daylight saving time", not "daylight savings time"


# 1.16 09-Nov-2000 aaron

Fix an off-by-one-hour error that would occur when changing the time across
DST (Daylight Saving Time); from NetBSD.


Revision tags: OPENBSD_2_8_BASE
# 1.15 15-Sep-2000 deraadt

check return value for setenv(3) for failure, and deal appropriately


Revision tags: OPENBSD_2_7_BASE
# 1.14 22-Jan-2000 deraadt

remove extra externs not needed because of unistd.h (rest of tree will be done later.. contact me if you want to help)


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.13 01-Feb-1999 d

GMT -> UTC in comments; make y2k hack easier to read


# 1.12 02-Jan-1999 weingart

Clean up some -Wall stuff, and a potential problem if TM_TIME_BASE was not
1900.


Revision tags: OPENBSD_2_4_BASE
# 1.11 01-Sep-1998 pjanzen

Clear up an overeager Y2K fix; be a little stricter with allowable times


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.10 17-Sep-1997 bri

Cosmetic:
Correct usage message.
Capitalize hours, minutes and seconds so that minutes are
distinguisable from months and so that things are in line
with strftime(3)


# 1.9 16-Sep-1997 deraadt

nicer spacing in usage


# 1.8 21-Aug-1997 deraadt

correct [yy]yy stuff in manpages and usage


# 1.7 23-Jul-1997 kstailey

tabify


# 1.6 23-Jun-1997 deraadt

duh, my mind is not crisp


# 1.5 23-Jun-1997 deraadt

yyyy specification code; m4@nts.umn.edu


Revision tags: OPENBSD_2_1_BASE
# 1.4 16-Apr-1997 deraadt

cleanup from danny@freebsd


# 1.3 04-Apr-1997 deraadt

wtmp repairs; netbsd


Revision tags: OPENBSD_2_0_BASE
# 1.2 23-Jun-1996 deraadt

update rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.52 13-Feb-2018 cheloha

atoll -> strtonum

ok millert@ tb@


# 1.51 23-Dec-2017 cheloha

As we only use the .tv_sec field, simplify gettimeofday(2) -> time(3).

While here, use err(3) instead of errx(3) if adjtime(2) fails.

Discussed/tweaked with/by tb@ and jca@.

ok tb@ jca@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.50 19-Oct-2016 schwarze

Delete useless setlocale(3) in src/bin/.
Minor cleanup while here: return from main, static void __dead usage, etc.
Based on a patch from Jan Stary <hans at stare dot cz>.
Feedback and OK tb@, OK millert@.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.49 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.48 07-Oct-2015 deraadt

tame "stdio rpath wpath". rpath is for localtime() and mktime(),
while wpath is for logwtmp(), a bit pessimistically since it is not clear
what could happen.
This is done AFTER the time is potentially set, since settimeofday() is
not available to us. Improvements and tests would be welcome.


Revision tags: OPENBSD_5_8_BASE
# 1.47 17-Apr-2015 deraadt

FALLTHROUGH in getopt is incorrect. While here use strtonum
to parse tz_minuteswest.
ok millert


# 1.46 17-Mar-2015 millert

Eliminate use of TM_YEAR_BASE. OK guenther@ deraadt@ miod@


# 1.45 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.44 07-Feb-2015 deraadt

When getopt processing flags, many should be flag=1 instead of flag++
ok tedu miod


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.43 21-Jan-2014 otto

localtime(3) can return NULL; seen by Rod Whitworth; ok guenther@


# 1.42 05-Jan-2014 schwarze

garbage collect unused global variable retval,
forgotten in rev. 1.36 when removing timed(8) support;
proofed by sobrado@


# 1.41 27-Nov-2013 okan

remove erroneous char cast to switch expression processing getopt(3);
not used in any cases.

ok deraadt@, guenther@, millert@


# 1.40 21-Nov-2013 deraadt

add unsigned char casts for specific calls to ctype.h macros.
ok guenther step


# 1.39 20-Oct-2013 guenther

Parse the argument the -r option with atoll() to support dates past 2038

from J Drivdal (xjd (at) rivu.net)


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.38 04-Dec-2012 deraadt

replace sys/param.h with sys/types.h (and sometimes add limits.h if needed)
ok guenther


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.37 08-Jul-2011 deraadt

extern.h no longer needed


# 1.36 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.35 11-Mar-2011 deraadt

Add a non-standard option that affects the output TZ only. The input (for
parsing) TZ is unaffected. This makes it it easier to convert timestamps
from any timezone to any other timezone -- no need for $() gymnastics
ok millert


# 1.34 11-Mar-2011 deraadt

Check that date(1) is not passed any extra arguments.
ok millert


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.33 31-Mar-2010 deraadt

Make a -DSMALL version of date(1) for the media


Revision tags: OPENBSD_4_7_BASE
# 1.32 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 28-Dec-2007 chl

printf field widths are always int, so add a cast to remove
"warning: field width is not type int"

"looks good" otto@


# 1.30 16-Oct-2007 sobrado

sync the synopsis and usage of commands

ok jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.29 25-May-2007 millert

Remove y2k hack. If no century is specified, use the current one.
OK otto@


# 1.28 12-Apr-2007 naddy

use UTC instead of GMT0 for -u; from Jared R.R.Spiegel <jrrs@ice-nine.org>
ok millert@, otto@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.27 29-Nov-2005 dhartmei

add an option -j which suppresses setting the clock, but parses the date
argument. useful to convert string-to-epoch (with +%s) or just to check
whether the argument is parsed correctly before really setting the clock.
ok millert@, deraadt@


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.26 15-Oct-2003 mpech

errx -> err. From form.

millert@ ok


Revision tags: OPENBSD_3_4_BASE
# 1.25 29-Jul-2003 deraadt

spacing


# 1.24 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.23 04-Jul-2002 deraadt

ansi


# 1.22 17-Apr-2002 deraadt

getopt idiot


Revision tags: OPENBSD_3_1_BASE
# 1.21 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.20 16-Jan-2002 mpech

missed some registers, kill'em!

millert@ ok


# 1.19 02-Dec-2001 deraadt

add -a to use adjtime(), like rdate(1) does


Revision tags: OPENBSD_3_0_BASE
# 1.18 06-Sep-2001 mpech

o) __progname aria;

millert@ ok.


Revision tags: OPENBSD_2_9_BASE
# 1.17 26-Mar-2001 millert

Fix comments, it is "daylight saving time", not "daylight savings time"


# 1.16 09-Nov-2000 aaron

Fix an off-by-one-hour error that would occur when changing the time across
DST (Daylight Saving Time); from NetBSD.


Revision tags: OPENBSD_2_8_BASE
# 1.15 15-Sep-2000 deraadt

check return value for setenv(3) for failure, and deal appropriately


Revision tags: OPENBSD_2_7_BASE
# 1.14 22-Jan-2000 deraadt

remove extra externs not needed because of unistd.h (rest of tree will be done later.. contact me if you want to help)


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.13 01-Feb-1999 d

GMT -> UTC in comments; make y2k hack easier to read


# 1.12 02-Jan-1999 weingart

Clean up some -Wall stuff, and a potential problem if TM_TIME_BASE was not
1900.


Revision tags: OPENBSD_2_4_BASE
# 1.11 01-Sep-1998 pjanzen

Clear up an overeager Y2K fix; be a little stricter with allowable times


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.10 17-Sep-1997 bri

Cosmetic:
Correct usage message.
Capitalize hours, minutes and seconds so that minutes are
distinguisable from months and so that things are in line
with strftime(3)


# 1.9 16-Sep-1997 deraadt

nicer spacing in usage


# 1.8 21-Aug-1997 deraadt

correct [yy]yy stuff in manpages and usage


# 1.7 23-Jul-1997 kstailey

tabify


# 1.6 23-Jun-1997 deraadt

duh, my mind is not crisp


# 1.5 23-Jun-1997 deraadt

yyyy specification code; m4@nts.umn.edu


Revision tags: OPENBSD_2_1_BASE
# 1.4 16-Apr-1997 deraadt

cleanup from danny@freebsd


# 1.3 04-Apr-1997 deraadt

wtmp repairs; netbsd


Revision tags: OPENBSD_2_0_BASE
# 1.2 23-Jun-1996 deraadt

update rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


# 1.51 23-Dec-2017 cheloha

As we only use the .tv_sec field, simplify gettimeofday(2) -> time(3).

While here, use err(3) instead of errx(3) if adjtime(2) fails.

Discussed/tweaked with/by tb@ and jca@.

ok tb@ jca@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.50 19-Oct-2016 schwarze

Delete useless setlocale(3) in src/bin/.
Minor cleanup while here: return from main, static void __dead usage, etc.
Based on a patch from Jan Stary <hans at stare dot cz>.
Feedback and OK tb@, OK millert@.


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.49 09-Oct-2015 deraadt

Change all tame callers to namechange to pledge(2).


# 1.48 07-Oct-2015 deraadt

tame "stdio rpath wpath". rpath is for localtime() and mktime(),
while wpath is for logwtmp(), a bit pessimistically since it is not clear
what could happen.
This is done AFTER the time is potentially set, since settimeofday() is
not available to us. Improvements and tests would be welcome.


Revision tags: OPENBSD_5_8_BASE
# 1.47 17-Apr-2015 deraadt

FALLTHROUGH in getopt is incorrect. While here use strtonum
to parse tz_minuteswest.
ok millert


# 1.46 17-Mar-2015 millert

Eliminate use of TM_YEAR_BASE. OK guenther@ deraadt@ miod@


# 1.45 15-Mar-2015 millert

tzfile.h is an internal header that should never have been installed.
What's worse, the tzfile.h that gets installed is over 20 years old
and doesn't match the real tzfile.h in libc/time. This makes the
tree safe for /usr/include/tzfile.h removal. The TM_YEAR_BASE
define has been moved to time.h temporarily until its usage is
replaced by 1900 in the tree. Actual removal of tzfile.h is pending
a ports build. Based on a diff from deraadt@


Revision tags: OPENBSD_5_7_BASE
# 1.44 07-Feb-2015 deraadt

When getopt processing flags, many should be flag=1 instead of flag++
ok tedu miod


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.43 21-Jan-2014 otto

localtime(3) can return NULL; seen by Rod Whitworth; ok guenther@


# 1.42 05-Jan-2014 schwarze

garbage collect unused global variable retval,
forgotten in rev. 1.36 when removing timed(8) support;
proofed by sobrado@


# 1.41 27-Nov-2013 okan

remove erroneous char cast to switch expression processing getopt(3);
not used in any cases.

ok deraadt@, guenther@, millert@


# 1.40 21-Nov-2013 deraadt

add unsigned char casts for specific calls to ctype.h macros.
ok guenther step


# 1.39 20-Oct-2013 guenther

Parse the argument the -r option with atoll() to support dates past 2038

from J Drivdal (xjd (at) rivu.net)


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.38 04-Dec-2012 deraadt

replace sys/param.h with sys/types.h (and sometimes add limits.h if needed)
ok guenther


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.37 08-Jul-2011 deraadt

extern.h no longer needed


# 1.36 07-Jul-2011 deraadt

timed's time is up. use ntpd(8). Even our own fossil developers
switched a while back.
ok miod, kettenis


# 1.35 11-Mar-2011 deraadt

Add a non-standard option that affects the output TZ only. The input (for
parsing) TZ is unaffected. This makes it it easier to convert timestamps
from any timezone to any other timezone -- no need for $() gymnastics
ok millert


# 1.34 11-Mar-2011 deraadt

Check that date(1) is not passed any extra arguments.
ok millert


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.33 31-Mar-2010 deraadt

Make a -DSMALL version of date(1) for the media


Revision tags: OPENBSD_4_7_BASE
# 1.32 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.31 28-Dec-2007 chl

printf field widths are always int, so add a cast to remove
"warning: field width is not type int"

"looks good" otto@


# 1.30 16-Oct-2007 sobrado

sync the synopsis and usage of commands

ok jmc@


Revision tags: OPENBSD_4_2_BASE
# 1.29 25-May-2007 millert

Remove y2k hack. If no century is specified, use the current one.
OK otto@


# 1.28 12-Apr-2007 naddy

use UTC instead of GMT0 for -u; from Jared R.R.Spiegel <jrrs@ice-nine.org>
ok millert@, otto@


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.27 29-Nov-2005 dhartmei

add an option -j which suppresses setting the clock, but parses the date
argument. useful to convert string-to-epoch (with +%s) or just to check
whether the argument is parsed correctly before really setting the clock.
ok millert@, deraadt@


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE
# 1.26 15-Oct-2003 mpech

errx -> err. From form.

millert@ ok


Revision tags: OPENBSD_3_4_BASE
# 1.25 29-Jul-2003 deraadt

spacing


# 1.24 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.23 04-Jul-2002 deraadt

ansi


# 1.22 17-Apr-2002 deraadt

getopt idiot


Revision tags: OPENBSD_3_1_BASE
# 1.21 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


# 1.20 16-Jan-2002 mpech

missed some registers, kill'em!

millert@ ok


# 1.19 02-Dec-2001 deraadt

add -a to use adjtime(), like rdate(1) does


Revision tags: OPENBSD_3_0_BASE
# 1.18 06-Sep-2001 mpech

o) __progname aria;

millert@ ok.


Revision tags: OPENBSD_2_9_BASE
# 1.17 26-Mar-2001 millert

Fix comments, it is "daylight saving time", not "daylight savings time"


# 1.16 09-Nov-2000 aaron

Fix an off-by-one-hour error that would occur when changing the time across
DST (Daylight Saving Time); from NetBSD.


Revision tags: OPENBSD_2_8_BASE
# 1.15 15-Sep-2000 deraadt

check return value for setenv(3) for failure, and deal appropriately


Revision tags: OPENBSD_2_7_BASE
# 1.14 22-Jan-2000 deraadt

remove extra externs not needed because of unistd.h (rest of tree will be done later.. contact me if you want to help)


Revision tags: OPENBSD_2_5_BASE OPENBSD_2_6_BASE
# 1.13 01-Feb-1999 d

GMT -> UTC in comments; make y2k hack easier to read


# 1.12 02-Jan-1999 weingart

Clean up some -Wall stuff, and a potential problem if TM_TIME_BASE was not
1900.


Revision tags: OPENBSD_2_4_BASE
# 1.11 01-Sep-1998 pjanzen

Clear up an overeager Y2K fix; be a little stricter with allowable times


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE
# 1.10 17-Sep-1997 bri

Cosmetic:
Correct usage message.
Capitalize hours, minutes and seconds so that minutes are
distinguisable from months and so that things are in line
with strftime(3)


# 1.9 16-Sep-1997 deraadt

nicer spacing in usage


# 1.8 21-Aug-1997 deraadt

correct [yy]yy stuff in manpages and usage


# 1.7 23-Jul-1997 kstailey

tabify


# 1.6 23-Jun-1997 deraadt

duh, my mind is not crisp


# 1.5 23-Jun-1997 deraadt

yyyy specification code; m4@nts.umn.edu


Revision tags: OPENBSD_2_1_BASE
# 1.4 16-Apr-1997 deraadt

cleanup from danny@freebsd


# 1.3 04-Apr-1997 deraadt

wtmp repairs; netbsd


Revision tags: OPENBSD_2_0_BASE
# 1.2 23-Jun-1996 deraadt

update rcsid


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision