time.c 367 B

123456789101112131415161718192021222324
  1. /*
  2. * time - return the current calendar time (seconds since jan 1, 1970)
  3. */
  4. /* $Id$ */
  5. #include <stdlib.h>
  6. #include <sys/time.h>
  7. #include <time.h>
  8. #include <ack/config.h>
  9. #ifndef ACKCONF_TIME_IS_A_SYSCALL
  10. time_t
  11. time(time_t *timer)
  12. {
  13. struct timeval tv;
  14. struct timezone tz;
  15. gettimeofday(&tv, &tz);
  16. if (timer) *timer = tv.tv_sec;
  17. return tv.tv_sec;
  18. }
  19. #endif