# include "basic.h"

int date (int argc, char **argv) {
  
  int N;
  struct timeval now;
  char *tstring;

  if ((argc != 1) && (argc != 2)) {
    fprintf (stderr, "USAGE: date [variable]\n");
    return (FALSE);
  }

  gettimeofday (&now, NULL);
  tstring = ctime (&now.tv_sec);
  N = strlen (tstring) - 1;
  tstring[N] = 0;

  if (argc == 1) {
    fprintf (stderr, "%s\n", tstring);
  } else {
    set_str_variable (argv[1], tstring);
  }

  return (TRUE);
}
