sl@0
|
1 |
#include <sys/types.h>
|
sl@0
|
2 |
#include <utime.h>
|
sl@0
|
3 |
#include <sys/_timeval.h>
|
sl@0
|
4 |
#include <sys/time.h>
|
sl@0
|
5 |
/*
|
sl@0
|
6 |
* Copyright (c) 1999-2004 Damien Miller <djm@mindrot.org>
|
sl@0
|
7 |
*
|
sl@0
|
8 |
* Permission to use, copy, modify, and distribute this software for any
|
sl@0
|
9 |
* purpose with or without fee is hereby granted, provided that the above
|
sl@0
|
10 |
* copyright notice and this permission notice appear in all copies.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
sl@0
|
13 |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
sl@0
|
14 |
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
sl@0
|
15 |
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
sl@0
|
16 |
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
sl@0
|
17 |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
sl@0
|
18 |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
sl@0
|
19 |
* * Portions Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
|
sl@0
|
20 |
*/
|
sl@0
|
21 |
|
sl@0
|
22 |
|
sl@0
|
23 |
//#ifndef HAVE_UTIMES
|
sl@0
|
24 |
|
sl@0
|
25 |
EXPORT_C int utimes(const char *filename, const struct timeval *tvp)
|
sl@0
|
26 |
{
|
sl@0
|
27 |
struct utimbuf ub ;
|
sl@0
|
28 |
|
sl@0
|
29 |
if(!tvp) //NULL CHECK
|
sl@0
|
30 |
{
|
sl@0
|
31 |
return utime(filename ,(struct utimbuf *) tvp) ;
|
sl@0
|
32 |
}
|
sl@0
|
33 |
|
sl@0
|
34 |
|
sl@0
|
35 |
ub.actime = tvp[0].tv_sec;
|
sl@0
|
36 |
ub.modtime = tvp[1].tv_sec;
|
sl@0
|
37 |
|
sl@0
|
38 |
return (utime(filename, &ub));
|
sl@0
|
39 |
}//#endif
|