--- a/toybox-f0c4b7476118/toys/posix/touch.c	2014-09-18 06:51:44.000000000 +0530
+++ b/Toybox/toys/posix/touch.c	2014-09-18 12:53:52.419637097 +0530
@@ -36,7 +36,7 @@
 {
   struct stat st;
 
-  if (stat(TT.file, &st)) return 1;
+  if (stat(file, &st)) return 1;
 
   if (flags & FLAG_a) {
     tv[0].tv_sec = st.st_atime;
@@ -73,6 +73,12 @@
       date = TT.date;
       i = strlen(date);
       if (i) {
+        // Trailing Z means UTC timezone, don't expect libc to know this.
+        if (toupper(date[i-1])=='Z') {
+          date[i-1] = 0;
+          setenv("TZ", "UTC0", 1);
+          localtime_r(&(tv->tv_sec), &tm);
+        }
         s = strptime(date, "%Y-%m-%dT%T", &tm);
         if (s && *s=='.') {
           sscanf(s, ".%d%n", &i, &len);
@@ -84,18 +90,17 @@
     // Set time from -t?
 
     } else {
-      strcpy(toybuf, "%Y%m%d%H%M");
       date = TT.time;
-      for (i=0;i<3;i++) {
-        s = strptime(date, toybuf+(i&2), &tm);
-        if (s) break;
-        toybuf[1]='y';
-      }
+      i = ((s = strchr(date, '.'))) ? s-date : strlen(date);
+      if (i == 8) strcpy(toybuf, "%m%d%H%M");
+      else if (i == 10) strcpy(toybuf, "%y%m%d%H%M");
+      else if (i == 12) strcpy(toybuf, "%Y%m%d%H%M");
+      else perror_exit("bad '%s'", date);
+      
       if (s && *s=='.') {
-        int count = sscanf(s, ".%2d%u%n", &(tm.tm_sec), &i, &len);
-
-        if (count==2) tv->tv_usec = i;
-        s += len;
+        if ((sscanf(s+1, "%2u%n", &(tm.tm_sec), &i) != 1) || *(s+i+1))
+          error_exit("bad '%s'", date);
+        s += (i+1);
       }
     }
 
@@ -119,7 +124,7 @@
     if ((flag == (FLAG_m|FLAG_a) || !fetch(*ss, tv, flag)) && !utimes(*ss, tv))
       ss++;
     else if (toys.optflags & FLAG_c) ss++;
-    else if (-1 != (fd = open(*ss, O_CREAT, 0666))) close(fd);
+    else if (access(*ss, F_OK) && (-1 != (fd = open(*ss, O_CREAT, 0666)))) close(fd);
     else perror_msg("'%s'", *ss++);
   }
 }
