summaryrefslogtreecommitdiff
path: root/test-date.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-30 13:19:56 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-30 13:19:56 -0700
commit89967023da94c0d874713284869e1924797d30bb (patch)
tree4f10da641a29ece5e16b3941bc9c7dcc4ba42432 /test-date.c
parent3a6a23e67d752e3083a52ad04c20c04e40c148e1 (diff)
downloadgit-89967023da94c0d874713284869e1924797d30bb.tar.gz
Make the date parsing accept pretty much any random crap.
This date parser turns line-noise into a date. Cool.
Diffstat (limited to 'test-date.c')
-rw-r--r--test-date.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test-date.c b/test-date.c
new file mode 100644
index 0000000000..8ec41c3118
--- /dev/null
+++ b/test-date.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <time.h>
+
+#include "cache.h"
+
+int main(int argc, char **argv)
+{
+ int i;
+
+ for (i = 1; i < argc; i++) {
+ char result[100];
+ time_t t;
+
+ memcpy(result, "bad", 4);
+ parse_date(argv[i], result, sizeof(result));
+ t = strtoul(result, NULL, 0);
+ printf("%s -> %s -> %s\n", argv[i], result, ctime(&t));
+ }
+ return 0;
+}