mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 21:45:41 +00:00
Create a branch for cmake bringup.
svn path=/branches/cmake-bringup/; revision=48236
This commit is contained in:
parent
a28e798006
commit
c424146e2c
20602 changed files with 0 additions and 1140137 deletions
61
lib/sdk/crt/time/futime.c
Normal file
61
lib/sdk/crt/time/futime.c
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* COPYRIGHT: LGPL, See LGPL.txt in the top level directory
|
||||
* PROJECT: ReactOS CRT library
|
||||
* FILE: lib/sdk/crt/time/futime.c
|
||||
* PURPOSE: Implementation of _futime
|
||||
* PROGRAMERS: Timo Kreuzer
|
||||
*/
|
||||
#include <precomp.h>
|
||||
#include <time.h>
|
||||
#include <sys/utime.h>
|
||||
#include "bitsfixup.h"
|
||||
|
||||
HANDLE fdtoh(int fd);
|
||||
|
||||
/******************************************************************************
|
||||
* \name _futime
|
||||
* \brief Set a files modification time.
|
||||
* \param [out] ptimeb Pointer to a structure of type struct _timeb that
|
||||
* recieves the current time.
|
||||
* \sa http://msdn.microsoft.com/en-us/library/95e68951.aspx
|
||||
*/
|
||||
int
|
||||
_futime(int fd, struct _utimbuf *filetime)
|
||||
{
|
||||
HANDLE handle;
|
||||
FILETIME at, wt;
|
||||
|
||||
handle = fdtoh(fd);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!filetime)
|
||||
{
|
||||
time_t currTime;
|
||||
_time(&currTime);
|
||||
RtlSecondsSince1970ToTime(currTime, (LARGE_INTEGER *)&at);
|
||||
wt = at;
|
||||
}
|
||||
else
|
||||
{
|
||||
RtlSecondsSince1970ToTime(filetime->actime, (LARGE_INTEGER *)&at);
|
||||
if (filetime->actime == filetime->modtime)
|
||||
{
|
||||
wt = at;
|
||||
}
|
||||
else
|
||||
{
|
||||
RtlSecondsSince1970ToTime(filetime->modtime, (LARGE_INTEGER *)&wt);
|
||||
}
|
||||
}
|
||||
|
||||
if (!SetFileTime(handle, NULL, &at, &wt))
|
||||
{
|
||||
__set_errno(GetLastError());
|
||||
return -1 ;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue