os/ossrv/genericopenlibs/openenvcore/libc/src/utimes.c
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/libc/src/utimes.c	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,39 @@
     1.4 +#include <sys/types.h>
     1.5 +#include <utime.h>
     1.6 +#include <sys/_timeval.h>
     1.7 +#include <sys/time.h>
     1.8 +/*
     1.9 + * Copyright (c) 1999-2004 Damien Miller <djm@mindrot.org>
    1.10 + *
    1.11 + * Permission to use, copy, modify, and distribute this software for any
    1.12 + * purpose with or without fee is hereby granted, provided that the above
    1.13 + * copyright notice and this permission notice appear in all copies.
    1.14 + *
    1.15 + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
    1.16 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    1.17 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
    1.18 + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    1.19 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    1.20 + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    1.21 + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    1.22 + * * Portions Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
    1.23 + */
    1.24 +
    1.25 +
    1.26 +//#ifndef HAVE_UTIMES
    1.27 +     
    1.28 +EXPORT_C int utimes(const char *filename,  const struct timeval *tvp)
    1.29 +{
    1.30 +	struct utimbuf ub  ;
    1.31 +	
    1.32 +	if(!tvp)   //NULL CHECK
    1.33 +		{
    1.34 +		return utime(filename ,(struct utimbuf *) tvp) ;  
    1.35 +		}
    1.36 +	   
    1.37 +
    1.38 +	ub.actime = tvp[0].tv_sec;
    1.39 +	ub.modtime = tvp[1].tv_sec;
    1.40 +	
    1.41 +	return (utime(filename, &ub));
    1.42 +}//#endif