Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Merge branch 'devel'
[palacios.git] / kitten / kernel / linux_syscalls / settimeofday.c
1 #include <lwk/kernel.h>
2 #include <lwk/time.h>
3 #include <arch/uaccess.h>
4
5 int
6 sys_settimeofday(
7         struct timeval  __user * tv,
8         struct timezone __user * tz
9 )
10 {
11         struct timeval  _tv;
12         struct timezone _tz;
13
14         if (tv != NULL) {
15                 if (copy_from_user(&_tv, tv, sizeof(_tv)))
16                         return -EFAULT;
17
18                 set_time(
19                   (_tv.tv_sec * NSEC_PER_SEC) + (_tv.tv_usec * NSEC_PER_USEC)
20                 );
21         }
22
23         if (tz != NULL) {
24                 if (copy_from_user(&_tz, tz, sizeof(_tz)))
25                         return -EFAULT;
26
27                 /* Only support setting timezone to 0 */
28                 if ((_tz.tz_minuteswest != 0) || (_tz.tz_dsttime != 0))
29                         return -EFAULT;
30         }
31
32         return 0;
33 }
34