ARM: Mes C Library: Add compile stub for time.

* lib/linux/time.c (time)[SYS_gettimeofday]: Implement using gettimeofday.
(time)[!SYS_time && !SYS_gettimeofday]: Compile stub.
This commit is contained in:
Jan Nieuwenhuizen 2020-06-02 21:26:36 +02:00 committed by Danny Milosavljevic
parent d8f5699d76
commit be1ff7e625
No known key found for this signature in database
GPG key ID: E71A35542C30BAA5

View file

@ -21,9 +21,48 @@
#include <linux/syscall.h> #include <linux/syscall.h>
#include <syscall.h> #include <syscall.h>
#include <time.h> #include <time.h>
#include <stdlib.h>
#if SYS_gettimeofday
#include <sys/time.h>
time_t
time (time_t * result)
{
struct timeval tv;
struct timezone tz;
if (gettimeofday (&tv, &tz) != 0)
return (time_t) -1;
if (result)
*result = tv.tv_sec;
return tv.tv_sec;
}
#elif SYS_time
time_t time_t
time (time_t * result) time (time_t * result)
{ {
return _sys_call1 (SYS_time, (long) result); return _sys_call1 (SYS_time, (long) result);
} }
#else
#warning there is no time
#include <mes/lib.h>
time_t
time (time_t * result)
{
static int stub = 0;
if (__mes_debug () && !stub)
eputs ("time stub\n");
stub = 1;
if (result)
*result = 0;
return 0;
}
#endif