2 * COPYRIGHT: LGPL, See LGPL.txt in the top level directory
3 * PROJECT: ReactOS CRT library
4 * FILE: lib/sdk/crt/time/futime.c
5 * PURPOSE: Implementation of _futime
6 * PROGRAMERS: Timo Kreuzer
9 #define RC_INVOKED 1 // to prevent inline functions
11 #include <sys/utime.h>
12 #include "bitsfixup.h"
16 /******************************************************************************
18 * \brief Set a files modification time.
19 * \param [out] ptimeb Pointer to a structure of type struct _timeb that
20 * recieves the current time.
21 * \sa http://msdn.microsoft.com/en-us/library/95e68951.aspx
24 _futime(int fd
, struct _utimbuf
*filetime
)
30 if (handle
== INVALID_HANDLE_VALUE
)
39 RtlSecondsSince1970ToTime(currTime
, (LARGE_INTEGER
*)&at
);
44 RtlSecondsSince1970ToTime(filetime
->actime
, (LARGE_INTEGER
*)&at
);
45 if (filetime
->actime
== filetime
->modtime
)
51 RtlSecondsSince1970ToTime(filetime
->modtime
, (LARGE_INTEGER
*)&wt
);
55 if (!SetFileTime(handle
, NULL
, &at
, &wt
))
57 __set_errno(GetLastError());