Beispiel #1
0
/*
 * CAUTION: clockobj_set_resolution() may be called during the init
 * phase only, not after. IOW, the resolution is perceived as a
 * constant when the application code executes. For performance
 * reason, we want to run locklessly for common time unit conversions,
 * so the clockobj implementation does assume that the clock
 * resolution will NOT be updated after the init phase.
 */
int clockobj_set_resolution(struct clockobj *clkobj, unsigned int resolution_ns)
{
#ifdef CONFIG_XENO_LORES_CLOCK_DISABLED
	assert(resolution_ns == 1);
#else
	__clockobj_set_resolution(clkobj, resolution_ns);

	/* Changing the resolution implies resetting the epoch. */
	clockobj_set_date(clkobj, 0);
#endif
	return 0;
}
Beispiel #2
0
u_long tm_set(u_long date, u_long time, u_long ticks)
{
	struct service svc;
	struct tm tm;
	ticks_t t;
	int ret;

	COPPERPLATE_PROTECT(svc);

	ret = date_to_tmstruct(date, time, ticks, &tm);
	if (ret)
		goto out;

	clockobj_caltime_to_ticks(&psos_clock, &tm, ticks, &t);
	clockobj_set_date(&psos_clock, t, 0);
out:
	COPPERPLATE_UNPROTECT(svc);

	return SUCCESS;
}