scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

time.c (242B)


      1 #include <time.h>
      2 
      3 #include "time.h"
      4 
      5 extern int _gettimeofday(struct timeval *restrict, void *);
      6 
      7 time_t
      8 time(time_t *t)
      9 {
     10 	struct timeval tv;
     11 
     12 	if (_gettimeofday(&tv, NULL) == -1)
     13 		return -1;
     14 	if (t)
     15 		*t = tv.tv_sec;
     16 	return tv.tv_sec;
     17 }