示例#1
0
int do_sys_settimeofday(struct timeval *tv, struct timezone *tz)
{
	static int firsttime = 1;

	if (!capable(CAP_SYS_TIME))
		return -EPERM;
		
	if (tz) {
		/* SMP safe, global irq locking makes it work. */
		sys_tz = *tz;
		if (firsttime) {
			firsttime = 0;
			if (!tv)
				warp_clock();
		}
	}
	if (tv)
	{
		/* SMP safe, again the code in arch/foo/time.c should
		 * globally block out interrupts when it runs.
		 */
		do_settimeofday(tv);
	}
	return 0;
}
示例#2
0
static void __init pxa_timer_init(void)
{
	struct timespec tv;
	unsigned long flags;

	set_rtc = pxa_set_rtc;

	tv.tv_nsec = 0;
	tv.tv_sec = pxa_get_rtc_time();
	do_settimeofday(&tv);

	OIER = 0;		/* disable any timer interrupts */
	OSSR = 0xf;		/* clear status on all timers */
	setup_irq(IRQ_OST0, &pxa_timer_irq);
	local_irq_save(flags);
	OIER = OIER_E0;		/* enable match on timer 0 to cause interrupts */
	OSMR0 = OSCR + LATCH;	/* set initial match */
	local_irq_restore(flags);

	/*
	 * OSCR runs continuously on PXA and is not written to,
	 * so we can use it as clock source directly.
	 */
	clocksource_pxa.mult =
		clocksource_hz2mult(CLOCK_TICK_RATE, clocksource_pxa.shift);
	clocksource_register(&clocksource_pxa);
}
示例#3
0
/*
 * In case for some reason the CMOS clock has not already been running
 * in UTC, but in some local time: The first time we set the timezone,
 * we will warp the clock so that it is ticking UTC time instead of
 * local time. Presumably, if someone is setting the timezone then we
 * are running in an environment where the programs understand about
 * timezones. This should be done at boot time in the /etc/rc script,
 * as soon as possible, so that the clock can be set right. Otherwise,
 * various programs will get confused when the clock gets warped.
 */
asmlinkage int sys_settimeofday(struct timeval *tv, struct timezone *tz)
{
	static int	firsttime = 1;
	struct timeval	new_tv;
	struct timezone new_tz;

	if (!suser())
		return -EPERM;
	if (tv) {
		int error = verify_area(VERIFY_READ, tv, sizeof(*tv));
		if (error)
			return error;
		memcpy_fromfs(&new_tv, tv, sizeof(*tv));
	}
	if (tz) {
		int error = verify_area(VERIFY_READ, tz, sizeof(*tz));
		if (error)
			return error;
		memcpy_fromfs(&new_tz, tz, sizeof(*tz));
	}
	if (tz) {
		sys_tz = new_tz;
		if (firsttime) {
			firsttime = 0;
			if (!tv)
				warp_clock();
		}
	}
	if (tv)
		do_settimeofday(&new_tv);
	return 0;
}
示例#4
0
文件: rtc.c 项目: jameshilliard/prism
static int mv_rtc_init(void)
{
	MV_RTC_TIME time;
	struct timespec tv;
	struct device *dev;

	mvRtcTimeGet(&time);
	dev = device_create(rtc_class, NULL, -1, NULL, "mv_rtc");

	/* Date which is not in the 21 century will stop the RTC on
 	   00:00:00 - 01/01/2000, write operation will trigger it */
	if ((time.year == 0) && (time.month == 1)  && (time.date == 1)) {
		mvRtcTimeSet(&time);
		printk(KERN_INFO "RTC has been updated!!!\n");
	}

	tv.tv_nsec = 0;
	/* same as in the U-Boot we use the year for century 20 only */
	tv.tv_sec = mktime ( time.year + 2000, time.month,
			time.date, time.hours,
			time.minutes, time.seconds);
	do_settimeofday(&tv);	
	set_rtc = mv_set_rtc;

	rtc_device_register("kw-rtc", dev, &rtc_ops, THIS_MODULE);
	printk("RTC registered\n");

	return 0;
}
static int alarm_set_rtc(struct timespec *ts)
{
	struct rtc_time new_rtc_tm;
	struct rtc_device *rtc_dev;
	unsigned long flags;
	int rv = 0;

	rtc_time_to_tm(ts->tv_sec, &new_rtc_tm);
#ifdef CONFIG_RTC_AUTO_PWRON
	pr_info("%s : set rtc %ld %ld - rtc %02d:%02d:%02d %02d/%02d/%04d\n", __func__,
		ts->tv_sec, ts->tv_nsec,
		new_rtc_tm.tm_hour, new_rtc_tm.tm_min,
		new_rtc_tm.tm_sec, new_rtc_tm.tm_mon + 1,
		new_rtc_tm.tm_mday,
		new_rtc_tm.tm_year + 1900);
#endif
	rtc_dev = alarmtimer_get_rtcdev();
	rv = do_settimeofday(ts);
	if (rv < 0)
		return rv;
	if (rtc_dev)
		rv = rtc_set_time(rtc_dev, &new_rtc_tm);

	spin_lock_irqsave(&alarm_slock, flags);
	alarm_pending |= ANDROID_ALARM_TIME_CHANGE_MASK;
	wake_up(&alarm_wait_queue);
	spin_unlock_irqrestore(&alarm_slock, flags);

	return rv;
}
示例#6
0
void
afs_osi_SetTime(osi_timeval_t * tvp)
{
#if defined(AFS_LINUX24_ENV)
    struct timeval tv;
    tv.tv_sec = tvp->tv_sec;
    tv.tv_usec = tvp->tv_usec;

    AFS_STATCNT(osi_SetTime);

    do_settimeofday(&tv);
#else
    extern int (*sys_settimeofdayp) (struct timeval * tv,
                                     struct timezone * tz);

    KERNEL_SPACE_DECL;

    AFS_STATCNT(osi_SetTime);

    TO_USER_SPACE();
    if (sys_settimeofdayp)
        (void)(*sys_settimeofdayp) (tvp, NULL);
    TO_KERNEL_SPACE();
#endif
}
示例#7
0
static int alarm_set_rtc(struct timespec *ts)
{
	struct rtc_time new_rtc_tm;
	struct rtc_device *rtc_dev;
	unsigned long flags;
	int rv = 0;

	if (rtc_local_time)
		rtc_time_to_tm((ts->tv_sec - sys_tz.tz_minuteswest * 60), &new_rtc_tm);
	else
		rtc_time_to_tm(ts->tv_sec, &new_rtc_tm);
	rtc_dev = alarmtimer_get_rtcdev();
	rv = do_settimeofday(ts);
	if (rv < 0)
		return rv;
	if (rtc_dev)
		rv = rtc_set_time(rtc_dev, &new_rtc_tm);

	spin_lock_irqsave(&alarm_slock, flags);
	alarm_pending |= ANDROID_ALARM_TIME_CHANGE_MASK;
	wake_up(&alarm_wait_queue);
	spin_unlock_irqrestore(&alarm_slock, flags);

	return rv;
}
示例#8
0
int do_sys_settimeofday(struct timespec *tv, struct timezone *tz)
{
	static int firsttime = 1;
	int error = 0;

	if (tv && !timespec_valid(tv))
		return -EINVAL;

	error = security_settime(tv, tz);
	if (error)
		return error;

	if (tz) {
		/* SMP safe, global irq locking makes it work. */
		sys_tz = *tz;
		if (firsttime) {
			firsttime = 0;
			if (!tv)
				warp_clock();
		}
	}
	if (tv)
	{
		/* SMP safe, again the code in arch/foo/time.c should
		 * globally block out interrupts when it runs.
		 */
		return do_settimeofday(tv);
	}
	return 0;
}
示例#9
0
文件: rtc_sync.c 项目: mangOH/mangOH
/*
 * this function syncs system time with RTC when startup
 * if there is valid time store in RTC static int rtc_hctosys(void)
 */
static int rtc_hctosys(void)
{
	int err;
	struct rtc_time tm;
	struct rtc_device *rtc = rtc_class_open("rtc1");
	if (rtc == NULL) {
		printk("%s: unable to open rtc device (rtc1) for rtc_hctosys\n",
			__FILE__);
		return -ENODEV;
	}

	err = rtc_read_time(rtc, &tm);
	if (err == 0) {
		err = rtc_valid_tm(&tm);
		if (err == 0) {
			struct timespec tv;

			tv.tv_nsec = NSEC_PER_SEC >> 1;

			rtc_tm_to_time(&tm, &tv.tv_sec);

			do_settimeofday(&tv);

			dev_info(rtc->dev.parent,
				"setting system clock to "
				"%d-%02d-%02d %02d:%02d:%02d UTC (%u)\n",
				tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
				tm.tm_hour, tm.tm_min, tm.tm_sec,
				(unsigned int) tv.tv_sec);
		} else { 
示例#10
0
static int alarm_set_rtc(struct timespec *ts)
{
	struct rtc_time new_rtc_tm;
	struct timespec old_rtc_time;
	struct rtc_device *rtc_dev;
	unsigned long flags;
	int rv = 0;

/* get original rct time */
		getnstimeofday(&old_rtc_time);

	rtc_time_to_tm(ts->tv_sec, &new_rtc_tm);
	rtc_dev = alarmtimer_get_rtcdev();
	rv = do_settimeofday(ts);
	if (rv < 0)
		return rv;
	if (rtc_dev)
		rv = rtc_set_time(rtc_dev, &new_rtc_tm);

	spin_lock_irqsave(&alarm_slock, flags);
	alarm_pending |= ANDROID_ALARM_TIME_CHANGE_MASK;
	delta += ts->tv_sec - old_rtc_time.tv_sec;
	wake_up(&alarm_wait_queue);
	wake_up(&alarm_wait_change_queue);
	spin_unlock_irqrestore(&alarm_slock, flags);

	return rv;
}
示例#11
0
static int mv_rtc_init(void)
{
	MV_RTC_TIME time;
	struct timespec tv;

	switch(mvBoardIdGet()) {
		case RD_88F5181L_VOIP_FXO_GE:
		case RD_88W8660_AP82S_DDR1: 
			return 0;
	}

	mvRtcDS1339TimeGet(&time);

	/* check if the year is invalid - bigger than 2038 */
	if (time.year >= 38) {
 	     time.year=0;
 	     mvRtcDS1339TimeSet(&time);
 	     printk(KERN_INFO "RTC has been updated!!!");
 	  }
 	    
	tv.tv_nsec = 0;
	/* same as in the U-Boot we use the year for century 20 only */
	tv.tv_sec = mktime ( time.year + 2000, time.month,
        			time.date, time.hours,
        			time.minutes, time.seconds);
	do_settimeofday(&tv);
	set_rtc = mv_set_rtc;
	register_rtc(&rtc_ops);
	printk("RTC registered\n");

	return 0;
}
示例#12
0
static void rtc_sync_adjust(void)
{
	struct rtc_time		rtc_time;
	static time_t		rtc_time_t;
	struct timespec		ts_system, ts_rtc, ts_delta, ts_delta_delta;

	getnstimeofday(&ts_system);
	s3c_rtc_gettime(NULL, &rtc_time);

	rtc_tm_to_time(&rtc_time, &rtc_time_t);
	/* RTC precision is 1 second; adjust delta for avg 1/2 sec err */
	set_normalized_timespec(&ts_rtc, rtc_time_t, NSEC_PER_SEC>>1);
	
	ts_delta = timespec_sub(ts_system, ts_rtc);
	ts_delta_delta = timespec_sub (ts_saved_delta, ts_delta);

	if (ts_delta_delta.tv_sec < -2 || ts_delta_delta.tv_sec >= 2)
	{
		/* 
		 * A differential beteen system time and rtc is over 2 second
		 * , let's adjust system time and save time delta
		 */
		set_normalized_timespec(&ts_system, rtc_time_t + ts_saved_delta.tv_sec, ts_saved_delta.tv_nsec);
		do_settimeofday(&ts_system);
		printk ("RTC_SYNC: adjust system time from rtc\n");
	}
}
int rtc_hctosys(void)
{
	int err = -ENODEV;
	struct rtc_time tm;
	struct timespec tv = {
		.tv_nsec = NSEC_PER_SEC >> 1,
	};
	struct rtc_device *rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);

	if (rtc == NULL) {
		pr_err("%s: unable to open rtc device (%s)\n",
			__FILE__, CONFIG_RTC_HCTOSYS_DEVICE);
		goto err_open;
	}

	err = rtc_read_time(rtc, &tm);
	if (err) {
		dev_err(rtc->dev.parent,
			"hctosys: unable to read the hardware clock\n");
		goto err_read;

	}

	/*
	 * Force update rtc year time to 2014
	 * (The release year of device)
	 */
	tm.tm_year = 114;

	err = rtc_valid_tm(&tm);
	if (err) {
		dev_err(rtc->dev.parent,
			"hctosys: invalid date/time\n");
		goto err_invalid;
	}

	rtc_tm_to_time(&tm, &tv.tv_sec);

	err = do_settimeofday(&tv);

	dev_info(rtc->dev.parent,
		"setting system clock to "
		"%d-%02d-%02d %02d:%02d:%02d UTC (%u)\n",
		tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
		tm.tm_hour, tm.tm_min, tm.tm_sec,
		(unsigned int) tv.tv_sec);

err_invalid:
err_read:
	rtc_class_close(rtc);

err_open:
	rtc_hctosys_ret = err;

	return err;
}

late_initcall(rtc_hctosys);
示例#14
0
int rtc_hctosys(void)
{
	int err = -ENODEV;
	struct rtc_time tm;
	struct timespec tv = {
		.tv_nsec = NSEC_PER_SEC >> 1,
	};
	struct rtc_device *rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);

	if (rtc == NULL) {
		pr_err("%s: unable to open rtc device (%s)\n",
			__FILE__, CONFIG_RTC_HCTOSYS_DEVICE);
		goto err_open;
	}

	err = rtc_read_time(rtc, &tm);
	if (err) {
		dev_err(rtc->dev.parent,
			"hctosys: unable to read the hardware clock\n");
		goto err_read;

	}

	err = rtc_valid_tm(&tm);
	if (err) {
		dev_err(rtc->dev.parent,
			"hctosys: invalid date/time\n");
		goto err_invalid;
	}

	rtc_tm_to_time(&tm, &tv.tv_sec);

	if (tv.tv_sec < 86400) {
		tv.tv_sec = 86400;
		pr_info("%s: Make sure the boot time starts from 86400 or more to avoid system server crash due to alarm trigger immediately\n", __FILE__);
	}
	do_settimeofday(&tv);

	dev_info(rtc->dev.parent,
		"setting system clock to "
		"%d-%02d-%02d %02d:%02d:%02d UTC (%u)\n",
		tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
		tm.tm_hour, tm.tm_min, tm.tm_sec,
		(unsigned int) tv.tv_sec);

err_invalid:
err_read:
	rtc_class_close(rtc);

err_open:
	rtc_hctosys_ret = err;

	return err;
}

late_initcall(rtc_hctosys);
示例#15
0
/*
 * Set guest time to host UTC time.
 */
static inline void do_adj_guesttime(u64 hosttime)
{
	s64 host_tns;
	struct timespec host_ts;

	host_tns = (hosttime - WLTIMEDELTA) * 100;
	host_ts = ns_to_timespec(host_tns);

	do_settimeofday(&host_ts);
}
static void rtc_sync_systime(struct rtc_time *tm)
{
	unsigned long time;
	struct timespec new_tv;

	rtc_tm_to_time(tm, &time);
	new_tv.tv_nsec = xtime.tv_nsec;
	new_tv.tv_sec = time;	
	do_settimeofday(&new_tv);
}
示例#17
0
文件: osi_misc.c 项目: bagdxk/openafs
void
afs_osi_SetTime(osi_timeval_t * tvp)
{
    struct timespec tv;
    tv.tv_sec = tvp->tv_sec;
    tv.tv_nsec = tvp->tv_usec * NSEC_PER_USEC;

    AFS_STATCNT(osi_SetTime);

    do_settimeofday(&tv);
}
示例#18
0
int empeg_state_restore (unsigned char *buffer)
{
	/* EMPEG_FLASHBASE+0x4000 to +0x5fff is the space used for
	   the power-down state saving: we work through here until
	   we find the last entry which has a valid CRC - this is
	   the one we use */
	int a,calculated_crc,stored_crc, result = 0;
	struct timeval t;

	/* Find last valid block */
	for(a=(STATE_BLOCKS-1);a>=0;a--) {
		volatile unsigned short *blockptr=STATE_BASE+(a*(STATE_BLOCK_SIZE/sizeof(short)));

		/* See if this has a good CRC */
		calculated_crc=state_makecrc((unsigned char*)blockptr,STATE_BLOCK_SIZE-2);
		stored_crc=blockptr[(STATE_BLOCK_SIZE/sizeof(short))-1];

		if (calculated_crc==stored_crc) {
			/* Copy from flash */
			memcpy(buffer,(void*)blockptr,STATE_BLOCK_SIZE);
			
			break;
			}
	}

	/* Nothing valid found? Return nulls */
#if 1	/* FIXME: 1 == normal ; 0 == nuke savearea */
	if (a<0)
#else
	dirty = 1;
	printk("empeg_state_restore: NUKED\n");
#endif
	{

		result = 1;	// failed
		memset(buffer,0,STATE_BLOCK_SIZE);
		printk("empeg_state_restore: FAILED\n");
	}

	/* Later empegs have an RTC */
	if (empeg_hardwarerevision()<6) {
		/* Before we go: the first 4 bytes of the block are the elapsed
		   unixtime: set it */
		unixtime=t.tv_sec=*((unsigned int*)buffer);
		t.tv_usec=0;
		do_settimeofday(&t);
	} else {				// Added by tman
		unixtime=xtime.tv_sec;		// Added by tman
	}

	/* Get power-on time */
	powerontime=*((unsigned int*)(buffer+4));
	return result;
}
示例#19
0
asmlinkage long sys_stime(time_t *tptr)
{
   struct timespec tv;

   if (!capable(CAP_SYS_TIME))
      return -EPERM;
   if (get_user(tv.tv_sec, tptr))
      return -EFAULT;

   tv.tv_nsec = 0;
   do_settimeofday(&tv);
   return 0;
}
示例#20
0
static int __init mpc834x_rtc_hookup(void)
{
	struct timespec tv;

	ppc_md.get_rtc_time = ds1374_get_rtc_time;
	ppc_md.set_rtc_time = ds1374_set_rtc_time;

	tv.tv_nsec = 0;
	tv.tv_sec = (ppc_md.get_rtc_time) ();
	do_settimeofday(&tv);

	return 0;
}
示例#21
0
static void l4x_rtc_update_time(struct work_struct *work)
{
	struct timespec ts;
	u64 current_time;

	l4x_rtc_update_offset();
	current_time = offset_to_realtime + l4rtc_get_timer();

	ts.tv_nsec = do_div(current_time, 1000000000);
	ts.tv_sec = current_time;

	do_settimeofday(&ts);
}
示例#22
0
static int __init
p3p440_rtc_hookup(void)
{
	struct timespec	tv;

        ppc_md.set_rtc_time = max6900_set_rtc_time;
        ppc_md.get_rtc_time = max6900_get_rtc_time;

	tv.tv_nsec = 0;
	tv.tv_sec = (ppc_md.get_rtc_time)();
	do_settimeofday(&tv);

	return 0;
}
示例#23
0
static int __init mpc8360_rtc_hookup(void)
{
    struct timespec tv;

    if (!machine_is(mpc836x_mds))
        return 0;

    ppc_md.get_rtc_time = ds1374_get_rtc_time;
    ppc_md.set_rtc_time = ds1374_set_rtc_time;

    tv.tv_nsec = 0;
    tv.tv_sec = (ppc_md.get_rtc_time) ();
    do_settimeofday(&tv);

    return 0;
}
示例#24
0
static void __init pxa_timer_init(void)
{
	struct timespec tv;

	set_rtc = pxa_set_rtc;

	tv.tv_nsec = 0;
	tv.tv_sec = pxa_get_rtc_time();
	do_settimeofday(&tv);

	OSMR0 = 0;		/* set initial match at 0 */
	OSSR = 0xf;		/* clear status on all timers */
	setup_irq(IRQ_OST0, &pxa_timer_irq);
	OIER |= OIER_E0;	/* enable match on timer 0 to cause interrupts */
	OSCR = 0;		/* initialize free-running timer, force first match */
}
static int __init time_init()
{
  struct timeval tv;
  struct timespec ts;
  
  ts.tv_nsec=0;
  ts.tv_sec=(unsigned long)mktime(2009,9,28,17,55,30);
  
  do_gettimeofday(&tv);
  printk("sec:%ld,nsec:%ld\n",tv.tv_sec,tv.tv_usec);

  printk("setting success:%d\n",do_settimeofday(&ts));
  printk("time_init success.\n");

  return 0;
}
示例#26
0
int rtc_hctosys(void)
{
	int err;
	struct rtc_time tm;
	struct rtc_device *rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);

	if (rtc == NULL) {
		printk("%s: unable to open rtc device (%s)\n",
			__FILE__, CONFIG_RTC_HCTOSYS_DEVICE);
		return -ENODEV;
	}

	err = rtc_read_time(rtc, &tm);
	if (err == 0) {
		err = rtc_valid_tm(&tm);
		if (err == 0) {
			struct timespec tv;
#ifdef CONFIG_RTC_DRV_MSM
			struct timeval curtv;
#endif

			tv.tv_nsec = NSEC_PER_SEC >> 1;

			rtc_tm_to_time(&tm, &tv.tv_sec);

#ifdef CONFIG_RTC_DRV_MSM
			/* Only update kernel time if seconds changed.. otherwise this 
			   causes confusion with A2DP.  RTC time is in seconds.. so every
			   invocation of do_settimeofday() will cause cur ms to skip.. */
			do_gettimeofday(&curtv);
			if ((tv.tv_sec > (curtv.tv_sec + 1)) ||
			    ((tv.tv_sec + 1) < curtv.tv_sec)) {
#endif
			do_settimeofday(&tv);

			dev_info(rtc->dev.parent,
				"setting system clock to "
				"%d-%02d-%02d %02d:%02d:%02d UTC (%u)\n",
				tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
				tm.tm_hour, tm.tm_min, tm.tm_sec,
				(unsigned int) tv.tv_sec);
#ifdef CONFIG_RTC_DRV_MSM
			}
#endif
		}
		else
示例#27
0
asmlinkage long sys_stime(time_t __user *tptr)
{
	struct timespec tv;
	int err;

	if (get_user(tv.tv_sec, tptr))
		return -EFAULT;

	tv.tv_nsec = 0;

	err = security_settime(&tv, NULL);
	if (err)
		return err;

	do_settimeofday(&tv);
	return 0;
}
示例#28
0
static void __init clps711x_timer_init(void)
{
	struct timespec tv;
	unsigned int syscon;

	syscon = clps_readl(SYSCON1);
	syscon |= SYSCON1_TC2S | SYSCON1_TC2M;
	clps_writel(syscon, SYSCON1);

	clps_writel(LATCH-1, TC2D); /* 512kHz / 100Hz - 1 */

	setup_irq(IRQ_TC2OI, &clps711x_timer_irq);

	tv.tv_nsec = 0;
	tv.tv_sec = clps_readl(RTCDR);
	do_settimeofday(&tv);
}
示例#29
0
static void __init sa1100_timer_init(void)
{
	struct timespec tv;

	set_rtc = sa1100_set_rtc;

	tv.tv_nsec = 0;
	tv.tv_sec = sa1100_get_rtc_time();
	do_settimeofday(&tv);

	OIER = 0;		/* disable any timer interrupts */
	OSCR = LATCH*2;		/* push OSCR out of the way */
	OSMR0 = LATCH;		/* set initial match */
	OSSR = 0xf;		/* clear status on all timers */
	setup_irq(IRQ_OST0, &sa1100_timer_irq);
	OIER = OIER_E0;		/* enable match on timer 0 to cause interrupts */
	OSCR = 0;		/* initialize free-running timer */
}
示例#30
0
文件: time.c 项目: sarnobat/knoppix
/*
 * This function is a copy of the architecture independent function
 * but which calls do_settimeofday rather than setting the xtime
 * fields itself.  This way, the fields which are used for 
 * do_settimeofday get updated too.
 */
long ppc64_sys_stime(long* tptr)
{
	long value;
	struct timespec myTimeval;

	if (!capable(CAP_SYS_TIME))
		return -EPERM;

	if (get_user(value, tptr))
		return -EFAULT;

	myTimeval.tv_sec = value;
	myTimeval.tv_nsec = 0;

	do_settimeofday(&myTimeval);

	return 0;
}