1. localtime() expects a time_t, not a pointer to unsigned long. 2. adapt to the kernel use of struct timeval.