New test.
[mono.git] / support / time.c
1 /*
2  * <time.h> wrapper functions.
3  *
4  * Authors:
5  *   Jonathan Pryor (jonpryor@vt.edu)
6  *
7  * Copyright (C) 2004 Jonathan Pryor
8  */
9
10 #define _SVID_SOURCE
11 #include <time.h>
12 #include <errno.h>
13
14 #include "map.h"
15 #include "mph.h"
16 #include <glib.h>
17
18 G_BEGIN_DECLS
19
20 #ifdef HAVE_STIME
21 gint32
22 Mono_Posix_Syscall_stime (mph_time_t *t)
23 {
24         time_t _t;
25         if (t == NULL) {
26                 errno = EFAULT;
27                 return -1;
28         }
29         mph_return_if_time_t_overflow (*t);
30         _t = (time_t) *t;
31         return stime (&_t);
32 }
33 #endif /* ndef HAVE_STIME */
34
35 mph_time_t
36 Mono_Posix_Syscall_time (mph_time_t *t)
37 {
38         time_t _t, r;
39         if (t == NULL) {
40                 errno = EFAULT;
41                 return -1;
42         }
43
44         mph_return_if_time_t_overflow (*t);
45
46         _t = (time_t) *t;
47         r = time (&_t);
48         *t = _t;
49
50         return r;
51 }
52
53 G_END_DECLS
54
55 /*
56  * vim: noexpandtab
57  */