2 * <sys/stat.h> wrapper functions.
5 * Jonathan Pryor (jonpryor@vt.edu)
7 * Copyright (C) 2004-2006 Jonathan Pryor
10 #include <sys/types.h>
20 Mono_Posix_Syscall_gettimeofday (
21 struct Mono_Posix_Timeval
*tv
,
28 r
= gettimeofday (&_tv
, &_tz
);
32 tv
->tv_sec
= _tv
.tv_sec
;
33 tv
->tv_usec
= _tv
.tv_usec
;
36 struct Mono_Posix_Timezone
*tz_
= (struct Mono_Posix_Timezone
*) tz
;
37 tz_
->tz_minuteswest
= _tz
.tz_minuteswest
;
46 Mono_Posix_Syscall_settimeofday (
47 struct Mono_Posix_Timeval
*tv
,
48 struct Mono_Posix_Timezone
*tz
)
50 #if defined(__HAIKU__)
51 /* FIXME: Haiku doesn't support this either, consider
52 using set_real_time_clock instead? */
55 struct timeval _tv
= {0};
56 struct timeval
*ptv
= NULL
;
57 struct timezone _tz
= {0};
58 struct timezone
*ptz
= NULL
;
62 _tv
.tv_sec
= tv
->tv_sec
;
63 _tv
.tv_usec
= tv
->tv_usec
;
67 _tz
.tz_minuteswest
= tz
->tz_minuteswest
;
72 r
= settimeofday (ptv
, ptz
);
78 static inline struct timeval
*
79 copy_utimes (struct timeval
* to
, struct Mono_Posix_Timeval
*from
)
82 to
[0].tv_sec
= from
[0].tv_sec
;
83 to
[0].tv_usec
= from
[0].tv_usec
;
84 to
[1].tv_sec
= from
[1].tv_sec
;
85 to
[1].tv_usec
= from
[1].tv_usec
;
93 Mono_Posix_Syscall_utimes(const char *filename
, struct Mono_Posix_Timeval
*tv
)
95 struct timeval _tv
[2];
98 ptv
= copy_utimes (_tv
, tv
);
100 return utimes (filename
, ptv
);
105 Mono_Posix_Syscall_lutimes(const char *filename
, struct Mono_Posix_Timeval
*tv
)
107 struct timeval _tv
[2];
110 ptv
= copy_utimes (_tv
, tv
);
112 return lutimes (filename
, ptv
);
114 #endif /* def HAVE_LUTIMES */
118 Mono_Posix_Syscall_futimes(int fd
, struct Mono_Posix_Timeval
*tv
)
120 struct timeval _tv
[2];
123 ptv
= copy_utimes (_tv
, tv
);
125 return futimes (fd
, ptv
);
127 #endif /* def HAVE_FUTIMES */