--- a/toys/posix/date.c	2014-04-14 02:37:22.000000000 +0530
+++ b/toys/posix/date.c	2014-04-16 11:52:02.588979024 +0530
@@ -55,25 +55,27 @@
 // returns 0 success, nonzero for error
 int parse_posixdate(char *str, struct tm *tm)
 {
-  struct timeval tv;
   int len;
 
   len = 0;
-  sscanf(str, "%2u%2u%2u%2u%n", &tm.tm_mon, &tm.tm_mday, &tm.tm_hour,
-    &tm.tm_min, &len);
+  sscanf(str, "%2u%2u%2u%2u%n", &tm->tm_mon, &tm->tm_mday, &tm->tm_hour,
+      &tm->tm_min, &len);
   if (len != 8) goto bad_date;
   str += len;
-  tm.tm_mon--;
+  tm->tm_mon--;
 
   // If year specified, overwrite one we fetched earlier
   if (*str && *str != '.') {
-    unsigned year, r1 = tm.tm_year % 100, r2 = (tm.tm_year + 50) % 100,
-      century = tm.tm_year - r1;
+    unsigned year, r1 = tm->tm_year % 100, r2 = (tm->tm_year + 50) % 100,
+             century = tm->tm_year - r1;
 
     len = 0;
     sscanf(str, "%u%n", &year, &len);
     if (len == 4) year -= 1900;
-    else if (len != 2) goto bad_date;
+    else if (len != 2) {
+bad_date:
+      error_exit("bad date '%s'", *toys.optargs);
+    }
     str += len;
 
     // 2 digit years, next 50 years are "future", last 50 years are "past".
@@ -82,11 +84,11 @@
     if ((r1 < r2) ? (r1 < year && year < r2) : (year < r1 || year > r2)) {
       if (year < r1) year += 100;
     } else if (year > r1) year -= 100;
-    tm.tm_year = year + century;
+    tm->tm_year = year + century;
   }
   if (*str == '.') {
     len = 0;
-    sscanf(str, ".%u%n", &tm.tm_sec, &len);
+    sscanf(str, ".%u%n", &tm->tm_sec, &len);
     str += len;
   }
 
@@ -130,7 +132,9 @@
 
   // Set the date
   } else if (setdate) {
-    if (parse_posixdate(setdate, tm)) goto bad_date;
+    struct timeval tv;
+
+    if (parse_posixdate(setdate, &tm)) goto bad_date;
 
     if (toys.optflags & FLAG_u) {
       // We can't just pass a timezone to mktime because posix.
