aboutsummaryrefslogtreecommitdiff
path: root/bin/date
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2019-03-12 04:49:59 +0000
committerWarner Losh <imp@FreeBSD.org>2019-03-12 04:49:59 +0000
commitd24ba0bb8642439a939c9dba5b604dc888a36b94 (patch)
treeabf96f8fe689b4dbb420b5ec4a841e58065679b0 /bin/date
parent329f0aa95244ad1e615e8c2abb50366b5b957bdf (diff)
downloadsrc-d24ba0bb8642439a939c9dba5b604dc888a36b94.tar.gz
src-d24ba0bb8642439a939c9dba5b604dc888a36b94.zip
Notes
Diffstat (limited to 'bin/date')
-rw-r--r--bin/date/date.c31
1 files changed, 3 insertions, 28 deletions
diff --git a/bin/date/date.c b/bin/date/date.c
index 2068992761d4..10e8a126d565 100644
--- a/bin/date/date.c
+++ b/bin/date/date.c
@@ -91,14 +91,12 @@ static const char *rfc2822_format = "%a, %d %b %Y %T %z";
int
main(int argc, char *argv[])
{
- struct timezone tz;
int ch, rflag;
bool Iflag, jflag, nflag, Rflag;
const char *format;
char buf[1024];
- char *endptr, *fmt;
+ char *fmt;
char *tmp;
- int set_timezone;
struct vary *v;
const struct vary *badv;
struct tm *lt;
@@ -108,18 +106,10 @@ main(int argc, char *argv[])
v = NULL;
fmt = NULL;
(void) setlocale(LC_TIME, "");
- tz.tz_dsttime = tz.tz_minuteswest = 0;
rflag = 0;
Iflag = jflag = nflag = Rflag = 0;
- set_timezone = 0;
- while ((ch = getopt(argc, argv, "d:f:I::jnRr:t:uv:")) != -1)
+ while ((ch = getopt(argc, argv, "f:I::jnRr:uv:")) != -1)
switch((char)ch) {
- case 'd': /* daylight savings time */
- tz.tz_dsttime = strtol(optarg, &endptr, 10) ? 1 : 0;
- if (endptr == optarg || *endptr != '\0')
- usage();
- set_timezone = 1;
- break;
case 'f':
fmt = optarg;
break;
@@ -160,13 +150,6 @@ main(int argc, char *argv[])
usage();
}
break;
- case 't': /* minutes west of UTC */
- /* error check; don't allow "PST" */
- tz.tz_minuteswest = strtol(optarg, &endptr, 10);
- if (endptr == optarg || *endptr != '\0')
- usage();
- set_timezone = 1;
- break;
case 'u': /* do everything in UTC */
(void)setenv("TZ", "UTC0", 1);
break;
@@ -179,13 +162,6 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
- /*
- * If -d or -t, set the timezone or daylight savings time; this
- * doesn't belong here; the kernel should not know about either.
- */
- if (set_timezone && settimeofday(NULL, &tz) != 0)
- err(1, "settimeofday (timezone)");
-
if (!rflag && time(&tval) == -1)
err(1, "time");
@@ -411,8 +387,7 @@ static void
usage(void)
{
(void)fprintf(stderr, "%s\n%s\n%s\n",
- "usage: date [-jnRu] [-d dst] [-r seconds|file] [-t west] "
- "[-v[+|-]val[ymwdHMS]]",
+ "usage: date [-jnRu] [-r seconds|file] [-v[+|-]val[ymwdHMS]]",
" "
"[-I[date | hours | minutes | seconds]]",
" "