Blob
1 #include <u.h>2 #include <libc.h>4 int uflg, nflg;6 void7 main(int argc, char *argv[])8 {9 ulong now;11 ARGBEGIN{12 case 'n': nflg = 1; break;13 case 'u': uflg = 1; break;14 default: fprint(2, "usage: date [-un] [seconds]\n"); exits("usage");15 }ARGEND17 if(argc == 1)18 now = strtoul(*argv, 0, 0);19 else20 now = time(0);22 if(nflg)23 print("%ld\n", now);24 else if(uflg)25 print("%s", asctime(gmtime(now)));26 else27 print("%s", ctime(now));29 exits(0);30 }