xref: /haiku/src/system/libroot/posix/time/stime.c (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
1 /*
2 ** Copyright 2004, Jérôme Duval. All rights reserved.
3 ** Distributed under the terms of the MIT License.
4 */
5 
6 #include <time.h>
7 #include <errno.h>
8 #include "syscalls.h"
9 
10 #include <errno_private.h>
11 
12 
13 int
14 stime(const time_t *tp)
15 {
16 	status_t status;
17 
18 	if (tp == NULL) {
19 		__set_errno(EINVAL);
20 		return -1;
21 	}
22 
23 	status = _kern_set_real_time_clock((bigtime_t)*tp * 1000000);
24 	if (status < B_OK) {
25 		__set_errno(status);
26 		return -1;
27 	}
28 	return 0;
29 }
30 
31