arch/m68k-amiga: Define the gcc symbol 'start' instead of using .bss
[AROS.git] / compiler / clib / utime.c
blobf8fa1e7093d89944fa0f6529f7cc9ee5397ea31c
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <errno.h>
7 #include <sys/time.h>
9 /*****************************************************************************
11 NAME */
13 #include <utime.h>
15 int utime(
17 /* SYNOPSIS */
18 const char *filename,
19 struct utimbuf *buf)
21 /* FUNCTION
22 Change last access and last modification time of the given file to
23 times specified in given utimbuf structure. If buf is NULL, the
24 current time will be used instead.
26 The utimbuf structure contains of two fields:
28 time_t actime; - last access time
29 time_t modtime; - last modification time
31 INPUTS
32 filename - Name of the file
33 buf - Pointer to utimbuf structure describing specified time.
35 RESULT
36 0 on success and -1 on error. If an error occurred, the global
37 variable errno is set.
39 NOTES
40 This function can be used to set access and modification times with
41 a resolution of 1 second, use utimes() if you need better precision.
43 EXAMPLE
45 BUGS
46 Since AROS has no notion of last access time, actime field is silently
47 ignored, only modification time of the file is set.
49 SEE ALSO
50 utimes()
52 INTERNALS
54 ******************************************************************************/
56 struct timeval ts[2];
58 if( buf == NULL )
60 time_t tt = time( NULL );
62 ts[0].tv_sec = tt;
63 ts[1].tv_sec = tt;
65 else
67 ts[0].tv_sec = buf->actime;
68 ts[1].tv_sec = buf->modtime;
71 ts[0].tv_usec = 0;
72 ts[1].tv_usec = 0;
74 return utimes(filename, ts);