aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/time.h10
-rw-r--r--kernel/time.c15
2 files changed, 14 insertions, 11 deletions
diff --git a/include/linux/time.h b/include/linux/time.h
index 9c444d9c4aa0..773b83ddd8ef 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -38,9 +38,11 @@ static __inline__ int timespec_equal(struct timespec *a, struct timespec *b)
38 return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); 38 return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec);
39} 39}
40 40
41extern unsigned long mktime (unsigned int year, unsigned int mon, 41extern unsigned long mktime(const unsigned int year, const unsigned int mon,
42 unsigned int day, unsigned int hour, 42 const unsigned int day, const unsigned int hour,
43 unsigned int min, unsigned int sec); 43 const unsigned int min, const unsigned int sec);
44
45extern void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec);
44 46
45extern struct timespec xtime; 47extern struct timespec xtime;
46extern struct timespec wall_to_monotonic; 48extern struct timespec wall_to_monotonic;
@@ -51,8 +53,6 @@ static inline unsigned long get_seconds(void)
51 return xtime.tv_sec; 53 return xtime.tv_sec;
52} 54}
53 55
54extern void set_normalized_timespec (struct timespec *ts, time_t sec, long nsec);
55
56struct timespec current_kernel_time(void); 56struct timespec current_kernel_time(void);
57 57
58#define CURRENT_TIME (current_kernel_time()) 58#define CURRENT_TIME (current_kernel_time())
diff --git a/kernel/time.c b/kernel/time.c
index fa569885e22b..a0502aef43ce 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -599,12 +599,15 @@ EXPORT_SYMBOL_GPL(getnstimestamp);
599 * will already get problems at other places on 2038-01-19 03:14:08) 599 * will already get problems at other places on 2038-01-19 03:14:08)
600 */ 600 */
601unsigned long 601unsigned long
602mktime (unsigned int year, unsigned int mon, 602mktime(const unsigned int year0, const unsigned int mon0,
603 unsigned int day, unsigned int hour, 603 const unsigned int day, const unsigned int hour,
604 unsigned int min, unsigned int sec) 604 const unsigned int min, const unsigned int sec)
605{ 605{
606 if (0 >= (int) (mon -= 2)) { /* 1..12 -> 11,12,1..10 */ 606 unsigned int mon = mon0, year = year0;
607 mon += 12; /* Puts Feb last since it has leap day */ 607
608 /* 1..12 -> 11,12,1..10 */
609 if (0 >= (int) (mon -= 2)) {
610 mon += 12; /* Puts Feb last since it has leap day */
608 year -= 1; 611 year -= 1;
609 } 612 }
610 613
@@ -630,7 +633,7 @@ mktime (unsigned int year, unsigned int mon,
630 * 0 <= tv_nsec < NSEC_PER_SEC 633 * 0 <= tv_nsec < NSEC_PER_SEC
631 * For negative values only the tv_sec field is negative ! 634 * For negative values only the tv_sec field is negative !
632 */ 635 */
633void set_normalized_timespec (struct timespec *ts, time_t sec, long nsec) 636void set_normalized_timespec(struct timespec *ts, time_t sec, long nsec)
634{ 637{
635 while (nsec >= NSEC_PER_SEC) { 638 while (nsec >= NSEC_PER_SEC) {
636 nsec -= NSEC_PER_SEC; 639 nsec -= NSEC_PER_SEC;