Subversion Repositories Kolibri OS

Rev

Rev 6082 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6082 Rev 6934
Line 123... Line 123...
123
	return true;
123
	return true;
124
}
124
}
Line 125... Line 125...
125
 
125
 
Line -... Line 126...
-
 
126
extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
-
 
127
 
-
 
128
/*
-
 
129
 * Validates if a timespec/timeval used to inject a time offset is valid.
-
 
130
 * Offsets can be postive or negative. The value of the timeval/timespec
-
 
131
 * is the sum of its fields, but *NOTE*: the field tv_usec/tv_nsec must
-
 
132
 * always be non-negative.
-
 
133
 */
-
 
134
static inline bool timeval_inject_offset_valid(const struct timeval *tv)
-
 
135
{
-
 
136
	/* We don't check the tv_sec as it can be positive or negative */
-
 
137
 
-
 
138
	/* Can't have more microseconds then a second */
-
 
139
	if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC)
-
 
140
		return false;
-
 
141
	return true;
-
 
142
}
-
 
143
 
-
 
144
static inline bool timespec_inject_offset_valid(const struct timespec *ts)
-
 
145
{
-
 
146
	/* We don't check the tv_sec as it can be positive or negative */
-
 
147
 
-
 
148
	/* Can't have more nanoseconds then a second */
-
 
149
	if (ts->tv_nsec < 0 || ts->tv_nsec >= NSEC_PER_SEC)
-
 
150
		return false;
-
 
151
	return true;
126
extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
152
}
127
 
153
 
Line 128... Line 154...
128
#define CURRENT_TIME		(current_kernel_time())
154
#define CURRENT_TIME		(current_kernel_time())
129
#define CURRENT_TIME_SEC	((struct timespec) { get_seconds(), 0 })
155
#define CURRENT_TIME_SEC	((struct timespec) { get_seconds(), 0 })