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