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