+13
include/linux/time.h
+13
include/linux/time.h
···
110
110
return true;
111
111
}
112
112
113
+
static inline bool timeval_valid(const struct timeval *tv)
114
+
{
115
+
/* Dates before 1970 are bogus */
116
+
if (tv->tv_sec < 0)
117
+
return false;
118
+
119
+
/* Can't have more microseconds then a second */
120
+
if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC)
121
+
return false;
122
+
123
+
return true;
124
+
}
125
+
113
126
extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
114
127
115
128
#define CURRENT_TIME (current_kernel_time())
+7
kernel/time/ntp.c
+7
kernel/time/ntp.c
···
633
633
if ((txc->modes & ADJ_SETOFFSET) && (!capable(CAP_SYS_TIME)))
634
634
return -EPERM;
635
635
636
+
if (txc->modes & ADJ_FREQUENCY) {
637
+
if (LONG_MIN / PPM_SCALE > txc->freq)
638
+
return -EINVAL;
639
+
if (LONG_MAX / PPM_SCALE < txc->freq)
640
+
return -EINVAL;
641
+
}
642
+
636
643
return 0;
637
644
}
638
645
+4
kernel/time/time.c
+4
kernel/time/time.c