--- defs.h.orig	2003-05-26 15:37:29.000000000 +0200
+++ defs.h	2005-11-20 16:16:59.000000000 +0100
@@ -265,8 +265,8 @@
     char *str;			/* fstype [i]lname [i]name [i]path */
     struct re_pattern_buffer *regex; /* regex */
     struct exec_val exec_vec;	/* exec ok */
-    struct long_val info;	/* atime ctime gid inum links mtime
-                                   size uid */
+    struct long_val info;	/* adate atime cdate ctime gid inum
+                                   links mdate mtime size uid */
     struct size_val size;	/* size */
     uid_t uid;			/* user */
     gid_t gid;			/* group */
@@ -334,10 +334,12 @@
 boolean parse_print PARAMS((char *argv[], int *arg_ptr));
 
 /* pred.c */
+boolean pred_adate PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_amin PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_and PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_anewer PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_atime PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
+boolean pred_cdate PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_close PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_cmin PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_cnewer PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
@@ -360,6 +362,7 @@
 boolean pred_links PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_lname PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_ls PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
+boolean pred_mdate PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_mmin PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_mtime PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
 boolean pred_name PARAMS((char *pathname, struct stat *stat_buf, struct predicate *pred_ptr));
--- parser.c.orig	2003-05-24 20:36:25.000000000 +0200
+++ parser.c	2005-11-20 16:16:18.000000000 +0100
@@ -24,6 +24,7 @@
 #include "modechange.h"
 #include "modetype.h"
 #include "xstrtol.h"
+#include "getdate.h"
 
 #if ENABLE_NLS
 # include <libintl.h>
@@ -55,9 +56,11 @@
 #endif
 
 static boolean parse_amin PARAMS((char *argv[], int *arg_ptr));
+static boolean parse_adate PARAMS((char *argv[], int *arg_ptr));
 static boolean parse_and PARAMS((char *argv[], int *arg_ptr));
 static boolean parse_anewer PARAMS((char *argv[], int *arg_ptr));
 static boolean parse_atime PARAMS((char *argv[], int *arg_ptr));
+static boolean parse_cdate PARAMS((char *argv[], int *arg_ptr));
 boolean parse_close PARAMS((char *argv[], int *arg_ptr));
 static boolean parse_cmin PARAMS((char *argv[], int *arg_ptr));
 static boolean parse_cnewer PARAMS((char *argv[], int *arg_ptr));
@@ -86,6 +89,7 @@
 static boolean parse_lname PARAMS((char *argv[], int *arg_ptr));
 static boolean parse_ls PARAMS((char *argv[], int *arg_ptr));
 static boolean parse_maxdepth PARAMS((char *argv[], int *arg_ptr));
+static boolean parse_mdate PARAMS((char *argv[], int *arg_ptr));
 static boolean parse_mindepth PARAMS((char *argv[], int *arg_ptr));
 static boolean parse_mmin PARAMS((char *argv[], int *arg_ptr));
 static boolean parse_mtime PARAMS((char *argv[], int *arg_ptr));
@@ -148,10 +152,12 @@
   {")", parse_close},
   {",", parse_comma},		/* GNU */
   {"a", parse_and},
+  {"adate", parse_adate},       /* GNU */
   {"amin", parse_amin},		/* GNU */
   {"and", parse_and},		/* GNU */
   {"anewer", parse_anewer},	/* GNU */
   {"atime", parse_atime},
+  {"cdate", parse_cdate},       /* GNU */
   {"cmin", parse_cmin},		/* GNU */
   {"cnewer", parse_cnewer},	/* GNU */
 #ifdef UNIMPLEMENTED_UNIX
@@ -185,6 +191,7 @@
   {"lname", parse_lname},	/* GNU */
   {"ls", parse_ls},		/* GNU, Unix */
   {"maxdepth", parse_maxdepth},	/* GNU */
+  {"mdate", parse_mdate},       /* GNU */
   {"mindepth", parse_mindepth},	/* GNU */
   {"mmin", parse_mmin},		/* GNU */
   {"mount", parse_xdev},	/* Unix */
@@ -248,6 +255,46 @@
    The predicate structure is updated with the new information. */
 
 static boolean
+parse_adate (char **argv, int *arg_ptr)
+{
+  struct predicate *our_pred;
+  enum comparison_type c_type;
+  time_t t, now;
+
+  if ((argv == NULL) || (argv[*arg_ptr] == NULL))
+    return (false);
+
+  char *str = argv[*arg_ptr];
+
+  switch (str[0])
+    {
+    case '+':
+      c_type = COMP_GT;
+      str++;
+      break;
+    case '-':
+      c_type = COMP_LT;
+      str++;
+      break;
+    default:
+      c_type = COMP_EQ;
+      break;
+    }
+
+  now = time(NULL);
+  t = get_date (str, &now);
+  if ( t == -1 )
+    return (false);
+     
+  our_pred = insert_primary (pred_adate);
+  our_pred->args.info.kind = c_type;
+  our_pred->args.info.negative = t < 0;
+  our_pred->args.info.l_val = t; 
+  (*arg_ptr)++;
+  return (true);
+}
+
+static boolean
 parse_amin (char **argv, int *arg_ptr)
 {
   struct predicate *our_pred;
@@ -306,6 +353,46 @@
   return (insert_time (argv, arg_ptr, pred_atime));
 }
 
+static boolean
+parse_cdate (char **argv, int *arg_ptr)
+{
+  struct predicate *our_pred;
+  enum comparison_type c_type;
+  time_t t, now;
+
+  if ((argv == NULL) || (argv[*arg_ptr] == NULL))
+    return (false);
+
+  char *str = argv[*arg_ptr];
+
+  switch (str[0])
+    {
+    case '+':
+      c_type = COMP_GT;
+      str++;
+      break;
+    case '-':
+      c_type = COMP_LT;
+      str++;
+      break;
+    default:
+      c_type = COMP_EQ;
+      break;
+    }
+
+  now = time(NULL);
+  t = get_date (str, &now );
+  if ( t == -1 )
+    return (false);
+     
+  our_pred = insert_primary (pred_cdate);
+  our_pred->args.info.kind = c_type;
+  our_pred->args.info.negative = t < 0;
+  our_pred->args.info.l_val = t; 
+  (*arg_ptr)++;
+  return (true);
+}
+
 boolean
 parse_close (char **argv, int *arg_ptr)
 {
@@ -680,6 +767,46 @@
 }
 
 static boolean
+parse_mdate (char **argv, int *arg_ptr)
+{
+  struct predicate *our_pred;
+  enum comparison_type c_type;
+  time_t t, now;
+
+  if ((argv == NULL) || (argv[*arg_ptr] == NULL))
+    return (false);
+
+  char *str = argv[*arg_ptr];
+
+  switch (str[0])
+    {
+    case '+':
+      c_type = COMP_GT;
+      str++;
+      break;
+    case '-':
+      c_type = COMP_LT;
+      str++;
+      break;
+    default:
+      c_type = COMP_EQ;
+      break;
+    }
+
+  now = time(NULL);
+  t = get_date (str, &now );
+  if ( t == -1 )
+    return (false);
+     
+  our_pred = insert_primary (pred_mdate);
+  our_pred->args.info.kind = c_type;
+  our_pred->args.info.negative = t < 0;
+  our_pred->args.info.l_val = t; 
+  (*arg_ptr)++;
+  return (true);
+}
+
+static boolean
 parse_mindepth (char **argv, int *arg_ptr)
 {
   int depth_len;
--- pred.c.orig	2003-05-24 20:36:25.000000000 +0200
+++ pred.c	2005-11-20 16:15:26.000000000 +0100
@@ -150,10 +150,12 @@
 
 struct pred_assoc pred_table[] =
 {
+  {pred_adate, "adate   "},
   {pred_amin, "amin    "},
   {pred_and, "and     "},
   {pred_anewer, "anewer  "},
   {pred_atime, "atime   "},
+  {pred_cdate, "cdate   "},
   {pred_close, ")       "},
   {pred_amin, "cmin    "},
   {pred_cnewer, "cnewer  "},
@@ -175,6 +177,7 @@
   {pred_links, "links   "},
   {pred_lname, "lname   "},
   {pred_ls, "ls      "},
+  {pred_mdate, "mdate   "},
   {pred_amin, "mmin    "},
   {pred_mtime, "mtime   "},
   {pred_name, "name    "},
@@ -245,6 +248,28 @@
    Return true if the file passes this predicate, false if not. */
 
 boolean
+pred_adate (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
+{
+  switch (pred_ptr->args.info.kind)
+    {
+    case COMP_GT:
+      if (stat_buf->st_atime > (time_t) pred_ptr->args.info.l_val)
+	return (true);
+      break;
+    case COMP_LT:
+      if (stat_buf->st_atime < (time_t) pred_ptr->args.info.l_val)
+	return (true);
+      break;
+    case COMP_EQ:
+      /* Not very useful. */
+      if (stat_buf->st_atime == (time_t) pred_ptr->args.info.l_val)
+	return (true);
+      break;
+    }
+  return (false);
+}
+
+boolean
 pred_amin (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
 {
   switch (pred_ptr->args.info.kind)
@@ -323,6 +348,28 @@
 }
 
 boolean
+pred_cdate (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
+{
+  switch (pred_ptr->args.info.kind)
+    {
+    case COMP_GT:
+      if (stat_buf->st_ctime > (time_t) pred_ptr->args.info.l_val)
+	return (true);
+      break;
+    case COMP_LT:
+      if (stat_buf->st_ctime < (time_t) pred_ptr->args.info.l_val)
+	return (true);
+      break;
+    case COMP_EQ:
+      /* Not very useful. */
+      if (stat_buf->st_ctime == (time_t) pred_ptr->args.info.l_val)
+	return (true);
+      break;
+    }
+  return (false);
+}
+
+boolean
 pred_close (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
 {
   return (true);
@@ -867,6 +914,28 @@
 }
 
 boolean
+pred_mdate (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
+{
+  switch (pred_ptr->args.info.kind)
+    {
+    case COMP_GT:
+      if (stat_buf->st_mtime > (time_t) pred_ptr->args.info.l_val)
+	return (true);
+      break;
+    case COMP_LT:
+      if (stat_buf->st_mtime < (time_t) pred_ptr->args.info.l_val)
+	return (true);
+      break;
+    case COMP_EQ:
+      /* Not very useful. */
+      if (stat_buf->st_mtime == (time_t) pred_ptr->args.info.l_val)
+	return (true);
+      break;
+    }
+  return (false);
+}
+
+boolean
 pred_mmin (char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
 {
   switch (pred_ptr->args.info.kind)
