libc: Implement futimes on top of futimens
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: Ie54de66ca1bc26a68f2922861e1edd1fdabb8f33
This commit is contained in:
parent
800acff10e
commit
76cd9c89bb
|
@ -22,10 +22,8 @@
|
||||||
* Included Files
|
* Included Files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
|
@ -33,6 +31,17 @@
|
||||||
|
|
||||||
int futimes(int fd, const struct timeval tv[2])
|
int futimes(int fd, const struct timeval tv[2])
|
||||||
{
|
{
|
||||||
set_errno(ENOTSUP);
|
struct timespec times[2];
|
||||||
return ERROR;
|
|
||||||
|
if (tv == NULL)
|
||||||
|
{
|
||||||
|
return futimens(fd, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
times[0].tv_sec = tv[0].tv_sec;
|
||||||
|
times[0].tv_nsec = tv[0].tv_usec * 1000;
|
||||||
|
times[1].tv_sec = tv[1].tv_sec;
|
||||||
|
times[1].tv_nsec = tv[1].tv_usec * 1000;
|
||||||
|
|
||||||
|
return futimens(fd, times);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue