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 // ToDo: replace zero by a ROOT_UID when usergroup.c is implemented 11 12 int 13 stime(const time_t *tp) 14 { 15 status_t status; 16 17 if (tp == NULL) { 18 errno = EINVAL; 19 return -1; 20 } 21 if (geteuid() != 0) { 22 errno = EPERM; 23 return -1; 24 } 25 status = _kern_set_real_time_clock(*tp); 26 if (status < B_OK) { 27 errno = status; 28 return -1; 29 } 30 return 0; 31 } 32 33