aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/touch/touch.c
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>1998-06-29 15:52:49 +0000
committerBruce Evans <bde@FreeBSD.org>1998-06-29 15:52:49 +0000
commit39470616b13dec5170b58a0a173f85a7a93cd8b7 (patch)
tree4f2687eca4b5261fb36b584338643fb22b7955fa /usr.bin/touch/touch.c
parenteeae79cc349429eafafe4942450da21ce1041ce7 (diff)
Notes
Diffstat (limited to 'usr.bin/touch/touch.c')
-rw-r--r--usr.bin/touch/touch.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/touch/touch.c b/usr.bin/touch/touch.c
index 32a7319564c2..712d72ecbe6f 100644
--- a/usr.bin/touch/touch.c
+++ b/usr.bin/touch/touch.c
@@ -184,11 +184,13 @@ stime_arg1(arg, tvp)
char *arg;
struct timeval *tvp;
{
+ time_t now;
struct tm *t;
int yearset;
char *p;
/* Start with the current time. */
- if ((t = localtime(&tvp[0].tv_sec)) == NULL)
+ now = tvp[0].tv_sec;
+ if ((t = localtime(&now)) == NULL)
err(1, "localtime");
/* [[CC]YY]MMDDhhmm[.SS] */
if ((p = strchr(arg, '.')) == NULL)
@@ -246,9 +248,11 @@ stime_arg2(arg, year, tvp)
int year;
struct timeval *tvp;
{
+ time_t now;
struct tm *t;
/* Start with the current time. */
- if ((t = localtime(&tvp[0].tv_sec)) == NULL)
+ now = tvp[0].tv_sec;
+ if ((t = localtime(&now)) == NULL)
err(1, "localtime");
t->tm_mon = ATOI2(arg); /* MMDDhhmm[yy] */